@duetds/components 6.0.3 → 6.0.4

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 (430) hide show
  1. package/hydrate/index.js +46 -38
  2. package/lib/cjs/duet-action-button.cjs.entry.js +3 -3
  3. package/lib/cjs/duet-alert.cjs.entry.js +1 -1
  4. package/lib/cjs/duet-badge.cjs.entry.js +1 -1
  5. package/lib/cjs/duet-breadcrumb.cjs.entry.js +1 -1
  6. package/lib/cjs/duet-breadcrumbs.cjs.entry.js +1 -1
  7. package/lib/cjs/duet-button_2.cjs.entry.js +3 -3
  8. package/lib/cjs/duet-caption_4.cjs.entry.js +3 -3
  9. package/lib/cjs/duet-card.cjs.entry.js +3 -3
  10. package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
  11. package/lib/cjs/duet-choice_2.cjs.entry.js +3 -3
  12. package/lib/cjs/duet-collapsible.cjs.entry.js +2 -2
  13. package/lib/cjs/duet-combobox.cjs.entry.js +1 -1
  14. package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
  15. package/lib/cjs/duet-date-picker.cjs.entry.js +2 -2
  16. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
  17. package/lib/cjs/duet-editable-table_3.cjs.entry.js +17 -14
  18. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
  19. package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
  20. package/lib/cjs/duet-footer.cjs.entry.js +1 -1
  21. package/lib/cjs/duet-grid_2.cjs.entry.js +2 -2
  22. package/lib/cjs/duet-header_2.cjs.entry.js +3 -3
  23. package/lib/cjs/duet-hero.cjs.entry.js +1 -1
  24. package/lib/cjs/duet-icon.cjs.entry.js +3 -3
  25. package/lib/cjs/duet-input_2.cjs.entry.js +1 -1
  26. package/lib/cjs/duet-layout.cjs.entry.js +1 -1
  27. package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
  28. package/lib/cjs/duet-modal.cjs.entry.js +2 -2
  29. package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
  30. package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
  31. package/lib/cjs/duet-pagination_2.cjs.entry.js +1 -1
  32. package/lib/cjs/duet-progress.cjs.entry.js +1 -1
  33. package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
  34. package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
  35. package/lib/cjs/duet-scrollable_3.cjs.entry.js +1 -1
  36. package/lib/cjs/duet-select.cjs.entry.js +1 -1
  37. package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
  38. package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
  39. package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
  40. package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
  41. package/lib/cjs/duet-tray.cjs.entry.js +2 -2
  42. package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
  43. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  44. package/lib/cjs/duet.cjs.js +1 -1
  45. package/lib/cjs/{focus-utils-15207057.js → focus-utils-8a615003.js} +1 -1
  46. package/lib/cjs/{index-28a9133b.js → index-d106d801.js} +1 -1
  47. package/lib/cjs/loader.cjs.js +1 -1
  48. package/lib/cjs/{token-utils-fef5b4eb.js → token-utils-f6e2f4ef.js} +1 -1
  49. package/lib/cjs/{tokens-29450bcb.js → tokens-4c69b122.js} +18 -15
  50. package/lib/cjs/{tokens.module-ef598645.js → tokens.module-1bb2d45e.js} +12 -10
  51. package/lib/collection/components/duet-choice-group/duet-choice-group.js +1 -1
  52. package/lib/collection/components/duet-upload/duet-upload.js +18 -15
  53. package/lib/dist-custom-elements/duet-action-button.d.ts +11 -0
  54. package/lib/dist-custom-elements/duet-action-button.js +9 -0
  55. package/lib/dist-custom-elements/duet-alert.d.ts +11 -0
  56. package/lib/dist-custom-elements/duet-alert.js +9 -0
  57. package/lib/dist-custom-elements/duet-badge.d.ts +11 -0
  58. package/lib/dist-custom-elements/duet-badge.js +9 -0
  59. package/lib/dist-custom-elements/duet-breadcrumb.d.ts +11 -0
  60. package/lib/dist-custom-elements/duet-breadcrumb.js +73 -0
  61. package/lib/dist-custom-elements/duet-breadcrumbs.d.ts +11 -0
  62. package/lib/dist-custom-elements/duet-breadcrumbs.js +90 -0
  63. package/lib/dist-custom-elements/duet-button.d.ts +11 -0
  64. package/lib/dist-custom-elements/duet-button.js +9 -0
  65. package/lib/dist-custom-elements/duet-caption.d.ts +11 -0
  66. package/lib/dist-custom-elements/duet-caption.js +9 -0
  67. package/lib/dist-custom-elements/duet-card.d.ts +11 -0
  68. package/lib/dist-custom-elements/duet-card.js +190 -0
  69. package/lib/dist-custom-elements/duet-checkbox.d.ts +11 -0
  70. package/lib/dist-custom-elements/duet-checkbox.js +163 -0
  71. package/lib/dist-custom-elements/duet-choice-group.d.ts +11 -0
  72. package/lib/dist-custom-elements/duet-choice-group.js +226 -0
  73. package/lib/dist-custom-elements/duet-choice.d.ts +11 -0
  74. package/lib/dist-custom-elements/duet-choice.js +390 -0
  75. package/lib/dist-custom-elements/duet-collapsible.d.ts +11 -0
  76. package/lib/dist-custom-elements/duet-collapsible.js +170 -0
  77. package/lib/dist-custom-elements/duet-combobox.d.ts +11 -0
  78. package/lib/dist-custom-elements/duet-combobox.js +432 -0
  79. package/lib/dist-custom-elements/duet-cookie-consent.d.ts +11 -0
  80. package/lib/dist-custom-elements/duet-cookie-consent.js +94 -0
  81. package/lib/dist-custom-elements/duet-date-picker.d.ts +11 -0
  82. package/lib/dist-custom-elements/duet-date-picker.js +906 -0
  83. package/lib/dist-custom-elements/duet-divider.d.ts +11 -0
  84. package/lib/dist-custom-elements/duet-divider.js +9 -0
  85. package/lib/dist-custom-elements/duet-editable-table.d.ts +11 -0
  86. package/lib/dist-custom-elements/duet-editable-table.js +9 -0
  87. package/lib/dist-custom-elements/duet-empty-state.d.ts +11 -0
  88. package/lib/dist-custom-elements/duet-empty-state.js +9 -0
  89. package/lib/dist-custom-elements/duet-fieldset.d.ts +11 -0
  90. package/lib/dist-custom-elements/duet-fieldset.js +9 -0
  91. package/lib/dist-custom-elements/duet-footer.d.ts +11 -0
  92. package/lib/dist-custom-elements/duet-footer.js +199 -0
  93. package/lib/dist-custom-elements/duet-grid-item.d.ts +11 -0
  94. package/lib/dist-custom-elements/duet-grid-item.js +9 -0
  95. package/lib/dist-custom-elements/duet-grid.d.ts +11 -0
  96. package/lib/dist-custom-elements/duet-grid.js +9 -0
  97. package/lib/dist-custom-elements/duet-header.d.ts +11 -0
  98. package/lib/dist-custom-elements/duet-header.js +764 -0
  99. package/lib/dist-custom-elements/duet-heading.d.ts +11 -0
  100. package/lib/dist-custom-elements/duet-heading.js +9 -0
  101. package/lib/dist-custom-elements/duet-hero.d.ts +11 -0
  102. package/lib/dist-custom-elements/duet-hero.js +314 -0
  103. package/lib/dist-custom-elements/duet-icon.d.ts +11 -0
  104. package/lib/dist-custom-elements/duet-icon.js +9 -0
  105. package/lib/dist-custom-elements/duet-input.d.ts +11 -0
  106. package/lib/dist-custom-elements/duet-input.js +9 -0
  107. package/lib/dist-custom-elements/duet-label.d.ts +11 -0
  108. package/lib/dist-custom-elements/duet-label.js +9 -0
  109. package/lib/dist-custom-elements/duet-layout.d.ts +11 -0
  110. package/lib/dist-custom-elements/duet-layout.js +107 -0
  111. package/lib/dist-custom-elements/duet-link.d.ts +11 -0
  112. package/lib/dist-custom-elements/duet-link.js +9 -0
  113. package/lib/dist-custom-elements/duet-list-item.d.ts +11 -0
  114. package/lib/dist-custom-elements/duet-list-item.js +9 -0
  115. package/lib/dist-custom-elements/duet-list.d.ts +11 -0
  116. package/lib/dist-custom-elements/duet-list.js +9 -0
  117. package/lib/dist-custom-elements/duet-logo.d.ts +11 -0
  118. package/lib/dist-custom-elements/duet-logo.js +9 -0
  119. package/lib/dist-custom-elements/duet-modal.d.ts +11 -0
  120. package/lib/dist-custom-elements/duet-modal.js +331 -0
  121. package/lib/dist-custom-elements/duet-notification-drawer.d.ts +11 -0
  122. package/lib/dist-custom-elements/duet-notification-drawer.js +194 -0
  123. package/lib/dist-custom-elements/duet-notification.d.ts +11 -0
  124. package/lib/dist-custom-elements/duet-notification.js +114 -0
  125. package/lib/dist-custom-elements/duet-number-input.d.ts +11 -0
  126. package/lib/dist-custom-elements/duet-number-input.js +516 -0
  127. package/lib/dist-custom-elements/duet-pagination.d.ts +11 -0
  128. package/lib/dist-custom-elements/duet-pagination.js +396 -0
  129. package/lib/dist-custom-elements/duet-paragraph.d.ts +11 -0
  130. package/lib/dist-custom-elements/duet-paragraph.js +9 -0
  131. package/lib/dist-custom-elements/duet-progress.d.ts +11 -0
  132. package/lib/dist-custom-elements/duet-progress.js +9 -0
  133. package/lib/dist-custom-elements/duet-radio-group.d.ts +11 -0
  134. package/lib/dist-custom-elements/duet-radio-group.js +216 -0
  135. package/lib/dist-custom-elements/duet-radio.d.ts +11 -0
  136. package/lib/dist-custom-elements/duet-radio.js +167 -0
  137. package/lib/dist-custom-elements/duet-range-slider.d.ts +11 -0
  138. package/lib/dist-custom-elements/duet-range-slider.js +209 -0
  139. package/lib/dist-custom-elements/duet-range-stepper.d.ts +11 -0
  140. package/lib/dist-custom-elements/duet-range-stepper.js +225 -0
  141. package/lib/dist-custom-elements/duet-scrollable.d.ts +11 -0
  142. package/lib/dist-custom-elements/duet-scrollable.js +9 -0
  143. package/lib/dist-custom-elements/duet-select.d.ts +11 -0
  144. package/lib/dist-custom-elements/duet-select.js +9 -0
  145. package/lib/dist-custom-elements/duet-spacer.d.ts +11 -0
  146. package/lib/dist-custom-elements/duet-spacer.js +9 -0
  147. package/lib/dist-custom-elements/duet-spinner.d.ts +11 -0
  148. package/lib/dist-custom-elements/duet-spinner.js +9 -0
  149. package/lib/dist-custom-elements/duet-step.d.ts +11 -0
  150. package/lib/dist-custom-elements/duet-step.js +150 -0
  151. package/lib/dist-custom-elements/duet-stepper.d.ts +11 -0
  152. package/lib/dist-custom-elements/duet-stepper.js +164 -0
  153. package/lib/dist-custom-elements/duet-tab-group.d.ts +11 -0
  154. package/lib/dist-custom-elements/duet-tab-group.js +301 -0
  155. package/lib/dist-custom-elements/duet-tab.d.ts +11 -0
  156. package/lib/dist-custom-elements/duet-tab.js +59 -0
  157. package/lib/dist-custom-elements/duet-table.d.ts +11 -0
  158. package/lib/dist-custom-elements/duet-table.js +9 -0
  159. package/lib/dist-custom-elements/duet-textarea.d.ts +11 -0
  160. package/lib/dist-custom-elements/duet-textarea.js +297 -0
  161. package/lib/dist-custom-elements/duet-toggle.d.ts +11 -0
  162. package/lib/dist-custom-elements/duet-toggle.js +150 -0
  163. package/lib/dist-custom-elements/duet-tooltip.d.ts +11 -0
  164. package/lib/dist-custom-elements/duet-tooltip.js +9 -0
  165. package/lib/dist-custom-elements/duet-tray.d.ts +11 -0
  166. package/lib/dist-custom-elements/duet-tray.js +175 -0
  167. package/lib/dist-custom-elements/duet-upload-aria-status.d.ts +11 -0
  168. package/lib/dist-custom-elements/duet-upload-aria-status.js +9 -0
  169. package/lib/dist-custom-elements/duet-upload.d.ts +11 -0
  170. package/lib/dist-custom-elements/duet-upload.js +1514 -0
  171. package/lib/dist-custom-elements/duet-visually-hidden.d.ts +11 -0
  172. package/lib/dist-custom-elements/duet-visually-hidden.js +9 -0
  173. package/lib/dist-custom-elements/index.d.ts +26 -0
  174. package/lib/dist-custom-elements/index.js +37 -0
  175. package/lib/dist-custom-elements/p-01de0640.js +37 -0
  176. package/lib/{esm/tokens-8ff8c570.js → dist-custom-elements/p-02305a1e.js} +18 -15
  177. package/lib/dist-custom-elements/p-08cfe544.js +125 -0
  178. package/lib/dist-custom-elements/p-09ed1ffa.js +160 -0
  179. package/lib/dist-custom-elements/p-0a928609.js +241 -0
  180. package/lib/dist-custom-elements/p-0b3f675e.js +47 -0
  181. package/lib/{esm/focus-utils-559691b3.js → dist-custom-elements/p-0b8f16f1.js} +1 -1
  182. package/lib/dist-custom-elements/p-115c79b6.js +6 -0
  183. package/lib/dist-custom-elements/p-12721178.js +57 -0
  184. package/lib/dist-custom-elements/p-14dcd82b.js +133 -0
  185. package/lib/dist-custom-elements/p-16d518fd.js +66 -0
  186. package/lib/dist-custom-elements/p-213ef84c.js +87 -0
  187. package/lib/dist-custom-elements/p-266411cf.js +307 -0
  188. package/lib/dist-custom-elements/p-3d987b87.js +75 -0
  189. package/lib/dist-custom-elements/p-3fc2d124.js +1666 -0
  190. package/lib/dist-custom-elements/p-4717744e.js +110 -0
  191. package/lib/dist-custom-elements/p-4ebf1618.js +13 -0
  192. package/lib/dist-custom-elements/p-56118313.js +53 -0
  193. package/lib/dist-custom-elements/p-565779f5.js +199 -0
  194. package/lib/dist-custom-elements/p-5a9d75e1.js +55 -0
  195. package/lib/dist-custom-elements/p-65d3ead5.js +428 -0
  196. package/lib/dist-custom-elements/p-6886544b.js +129 -0
  197. package/lib/dist-custom-elements/p-6e74e660.js +275 -0
  198. package/lib/dist-custom-elements/p-704245ef.js +9 -0
  199. package/lib/dist-custom-elements/p-76f00bd5.js +10 -0
  200. package/lib/dist-custom-elements/p-7739604d.js +214 -0
  201. package/lib/dist-custom-elements/p-81c9b244.js +65 -0
  202. package/lib/{esm/token-utils-df78f4d8.js → dist-custom-elements/p-86faf728.js} +1 -1
  203. package/lib/dist-custom-elements/p-88511d7a.js +275 -0
  204. package/lib/dist-custom-elements/p-9c732bb9.js +193 -0
  205. package/lib/dist-custom-elements/p-acdba2db.js +114 -0
  206. package/lib/dist-custom-elements/p-b08e57cf.js +37 -0
  207. package/lib/dist-custom-elements/p-b9058029.js +138 -0
  208. package/lib/dist-custom-elements/p-bd4b92c4.js +86 -0
  209. package/lib/dist-custom-elements/p-bd779757.js +184 -0
  210. package/lib/dist-custom-elements/p-c1325e35.js +11 -0
  211. package/lib/dist-custom-elements/p-c70f3ccb.js +70 -0
  212. package/lib/dist-custom-elements/p-d004da5f.js +6 -0
  213. package/lib/dist-custom-elements/p-d4c234ed.js +390 -0
  214. package/lib/dist-custom-elements/p-d8549efe.js +20 -0
  215. package/lib/dist-custom-elements/p-d96debb6.js +287 -0
  216. package/lib/dist-custom-elements/p-da03a443.js +154 -0
  217. package/lib/dist-custom-elements/p-e294c0fb.js +341 -0
  218. package/lib/dist-custom-elements/p-e4d5fbc0.js +87 -0
  219. package/lib/dist-custom-elements/p-e5c8a58f.js +71 -0
  220. package/lib/dist-custom-elements/p-ede854e1.js +92 -0
  221. package/lib/dist-custom-elements/p-ef8eff22.js +64 -0
  222. package/lib/dist-custom-elements/p-f11208c3.js +6 -0
  223. package/lib/dist-custom-elements/p-f7db7c40.js +98 -0
  224. package/lib/dist-custom-elements/p-fc5362e7.js +61 -0
  225. package/lib/duet/duet.esm.js +1 -1
  226. package/lib/duet/duet.js +1 -1
  227. package/lib/duet/{p-6c875cfa.system.entry.js → p-01c551f1.system.entry.js} +1 -1
  228. package/lib/duet/p-02305a1e.js +4 -0
  229. package/lib/duet/{p-1010fb94.entry.js → p-033bfa67.entry.js} +1 -1
  230. package/lib/duet/{p-946aa901.system.entry.js → p-07a850a5.system.entry.js} +1 -1
  231. package/lib/duet/{p-9e54127f.system.entry.js → p-09e2ff96.system.entry.js} +1 -1
  232. package/lib/duet/{p-d0cee171.entry.js → p-0b74af40.entry.js} +1 -1
  233. package/lib/duet/{p-2bd79d6b.entry.js → p-0c2a51ac.entry.js} +1 -1
  234. package/lib/duet/{p-eb54474f.system.entry.js → p-0c9f0b8a.system.entry.js} +1 -1
  235. package/lib/duet/{p-104bf1b5.entry.js → p-0d96924d.entry.js} +1 -1
  236. package/lib/duet/{p-d444107c.system.entry.js → p-0e48bca9.system.entry.js} +1 -1
  237. package/lib/duet/{p-de815460.system.entry.js → p-0e98f667.system.entry.js} +1 -1
  238. package/lib/duet/{p-cfa50753.system.js → p-1999f503.system.js} +1 -1
  239. package/lib/duet/{p-4034b322.system.entry.js → p-1a41550e.system.entry.js} +1 -1
  240. package/lib/duet/{p-bec24271.system.entry.js → p-1bd57792.system.entry.js} +1 -1
  241. package/lib/duet/{p-dab594cf.system.entry.js → p-1e0d7680.system.entry.js} +1 -1
  242. package/lib/duet/{p-6841adb8.system.entry.js → p-1ebd7945.system.entry.js} +1 -1
  243. package/lib/duet/p-1fc60a60.system.js +4 -0
  244. package/lib/duet/{p-47ed8218.entry.js → p-21662682.entry.js} +1 -1
  245. package/lib/duet/{p-b008fe25.entry.js → p-23943f39.entry.js} +1 -1
  246. package/lib/duet/{p-92d95bde.system.entry.js → p-23a8fa64.system.entry.js} +1 -1
  247. package/lib/duet/{p-72443e94.system.entry.js → p-264a0e0c.system.entry.js} +1 -1
  248. package/lib/duet/{p-5d967d15.entry.js → p-27f72e70.entry.js} +1 -1
  249. package/lib/duet/{p-09364233.entry.js → p-2a3b1a2e.entry.js} +1 -1
  250. package/lib/duet/{p-df11c241.system.entry.js → p-2b320481.system.entry.js} +1 -1
  251. package/lib/duet/p-32f7178a.system.js +4 -0
  252. package/lib/duet/{p-e3983bfe.entry.js → p-3620ded5.entry.js} +1 -1
  253. package/lib/duet/{p-b01e2523.entry.js → p-3904232a.entry.js} +1 -1
  254. package/lib/duet/{p-2bba6489.entry.js → p-3b173cbd.entry.js} +1 -1
  255. package/lib/duet/{p-087d72dd.system.entry.js → p-430acad4.system.entry.js} +1 -1
  256. package/lib/duet/{p-23ba48a5.system.entry.js → p-4463946b.system.entry.js} +1 -1
  257. package/lib/duet/{p-8157e5bb.system.entry.js → p-44e9b1c8.system.entry.js} +1 -1
  258. package/lib/duet/p-49ce11a1.entry.js +4 -0
  259. package/lib/duet/{p-06ab2787.system.entry.js → p-4d6feeb5.system.entry.js} +1 -1
  260. package/lib/duet/{p-f7ac05dd.system.entry.js → p-4d767c61.system.entry.js} +1 -1
  261. package/lib/duet/{p-e0f6ebf4.system.entry.js → p-4f1fe415.system.entry.js} +1 -1
  262. package/lib/duet/{p-de3c0f4d.js → p-532e9db7.js} +1 -1
  263. package/lib/duet/{p-9f8a51b4.system.entry.js → p-55fd512b.system.entry.js} +1 -1
  264. package/lib/duet/{p-398a79a0.js → p-588be556.js} +1 -1
  265. package/lib/duet/{p-074bfd45.entry.js → p-5af6d9e2.entry.js} +1 -1
  266. package/lib/duet/{p-9308c1e6.entry.js → p-5e1d64d8.entry.js} +1 -1
  267. package/lib/duet/{p-4c93a18e.system.entry.js → p-5f6452ce.system.entry.js} +1 -1
  268. package/lib/duet/{p-de986d77.system.entry.js → p-60e29f52.system.entry.js} +1 -1
  269. package/lib/duet/{p-e1654a8b.system.entry.js → p-613c4099.system.entry.js} +1 -1
  270. package/lib/duet/{p-94c07a46.system.entry.js → p-61444a3d.system.entry.js} +1 -1
  271. package/lib/duet/{p-d0f72f22.js → p-6aca8584.js} +1 -1
  272. package/lib/duet/{p-db15d420.system.entry.js → p-6e5f2016.system.entry.js} +1 -1
  273. package/lib/duet/{p-63dbd5af.system.entry.js → p-6f93638a.system.entry.js} +1 -1
  274. package/lib/duet/{p-c8d9da51.entry.js → p-71105750.entry.js} +1 -1
  275. package/lib/duet/{p-db115036.entry.js → p-73c6e5fb.entry.js} +1 -1
  276. package/lib/duet/{p-b3dc55a6.system.entry.js → p-751f6957.system.entry.js} +1 -1
  277. package/lib/duet/{p-1931d33f.system.js → p-77600ed7.system.js} +1 -1
  278. package/lib/duet/{p-571440c7.system.entry.js → p-77ca874f.system.entry.js} +1 -1
  279. package/lib/duet/{p-c2e37fb4.entry.js → p-787f9eba.entry.js} +1 -1
  280. package/lib/duet/{p-674e546f.system.entry.js → p-7ad2cb10.system.entry.js} +1 -1
  281. package/lib/duet/{p-b066a6b7.entry.js → p-7de4d97d.entry.js} +1 -1
  282. package/lib/duet/{p-3d029dce.system.entry.js → p-8107aeb5.system.entry.js} +1 -1
  283. package/lib/duet/{p-31004a7b.system.entry.js → p-86cb85b9.system.entry.js} +1 -1
  284. package/lib/duet/{p-f2eaad1e.js → p-875ae637.js} +1 -1
  285. package/lib/duet/{p-de146ffa.system.entry.js → p-8aafa8e7.system.entry.js} +1 -1
  286. package/lib/duet/{p-064dd5fd.entry.js → p-8b09a46f.entry.js} +1 -1
  287. package/lib/duet/{p-16521f2d.entry.js → p-8c08e7ba.entry.js} +1 -1
  288. package/lib/duet/{p-0626271f.entry.js → p-8e8f8b29.entry.js} +1 -1
  289. package/lib/duet/{p-300147ad.entry.js → p-9094fcf8.entry.js} +1 -1
  290. package/lib/duet/{p-5beb69ac.entry.js → p-988a781d.entry.js} +1 -1
  291. package/lib/duet/{p-cca9c605.system.entry.js → p-a395d4bc.system.entry.js} +1 -1
  292. package/lib/duet/{p-97a369d6.entry.js → p-a585113b.entry.js} +1 -1
  293. package/lib/duet/{p-ef4b4f35.entry.js → p-aa8973fc.entry.js} +1 -1
  294. package/lib/duet/{p-23ad5f8a.entry.js → p-ab7f4070.entry.js} +1 -1
  295. package/lib/duet/{p-49db53a1.system.entry.js → p-ab89d948.system.entry.js} +1 -1
  296. package/lib/duet/{p-20271117.entry.js → p-aef02083.entry.js} +1 -1
  297. package/lib/duet/{p-c5499bc3.entry.js → p-afdc57da.entry.js} +1 -1
  298. package/lib/duet/{p-9f18afd6.entry.js → p-b2abaa9e.entry.js} +1 -1
  299. package/lib/duet/{p-744ce6ce.entry.js → p-b55e55b5.entry.js} +1 -1
  300. package/lib/duet/{p-3cc55c8a.system.entry.js → p-bbc91480.system.entry.js} +1 -1
  301. package/lib/duet/{p-1aca544d.entry.js → p-bbe1a2cd.entry.js} +1 -1
  302. package/lib/duet/{p-8c409ffe.system.entry.js → p-bd3c926c.system.entry.js} +1 -1
  303. package/lib/duet/{p-e2ac0727.system.entry.js → p-bec16aea.system.entry.js} +1 -1
  304. package/lib/duet/p-bf59e11d.entry.js +4 -0
  305. package/lib/duet/{p-ab2f08b3.system.entry.js → p-c4217626.system.entry.js} +1 -1
  306. package/lib/duet/{p-5658ac20.system.entry.js → p-c5f6ea62.system.entry.js} +1 -1
  307. package/lib/duet/{p-41cb95cb.entry.js → p-c6d05091.entry.js} +1 -1
  308. package/lib/duet/{p-0f7f7e7d.system.entry.js → p-c73a591d.system.entry.js} +1 -1
  309. package/lib/duet/{p-6b0a4b3b.entry.js → p-c863a0d1.entry.js} +1 -1
  310. package/lib/duet/{p-c41b07d7.entry.js → p-c986532d.entry.js} +1 -1
  311. package/lib/duet/{p-ae515c54.entry.js → p-caa49454.entry.js} +1 -1
  312. package/lib/duet/{p-9fcac068.system.entry.js → p-ccb0de84.system.entry.js} +1 -1
  313. package/lib/duet/{p-18cc5627.system.js → p-d209191d.system.js} +1 -1
  314. package/lib/duet/{p-bb9624c3.entry.js → p-defba7cd.entry.js} +1 -1
  315. package/lib/duet/{p-339e5901.system.js → p-df785776.system.js} +1 -1
  316. package/lib/duet/{p-691f609b.entry.js → p-e9862947.entry.js} +1 -1
  317. package/lib/duet/{p-5d1787cb.entry.js → p-eb74c96e.entry.js} +1 -1
  318. package/lib/duet/{p-0ae59d7c.entry.js → p-ece47184.entry.js} +1 -1
  319. package/lib/duet/{p-89048c6f.entry.js → p-f09f968c.entry.js} +1 -1
  320. package/lib/duet/{p-68c3b19f.entry.js → p-f97776be.entry.js} +1 -1
  321. package/lib/duet/{p-6eecfced.system.entry.js → p-fe8fc877.system.entry.js} +1 -1
  322. package/lib/esm/duet-action-button.entry.js +3 -3
  323. package/lib/esm/duet-alert.entry.js +1 -1
  324. package/lib/esm/duet-badge.entry.js +1 -1
  325. package/lib/esm/duet-breadcrumb.entry.js +1 -1
  326. package/lib/esm/duet-breadcrumbs.entry.js +1 -1
  327. package/lib/esm/duet-button_2.entry.js +3 -3
  328. package/lib/esm/duet-caption_4.entry.js +3 -3
  329. package/lib/esm/duet-card.entry.js +3 -3
  330. package/lib/esm/duet-checkbox.entry.js +1 -1
  331. package/lib/esm/duet-choice_2.entry.js +3 -3
  332. package/lib/esm/duet-collapsible.entry.js +2 -2
  333. package/lib/esm/duet-combobox.entry.js +1 -1
  334. package/lib/esm/duet-cookie-consent.entry.js +1 -1
  335. package/lib/esm/duet-date-picker.entry.js +2 -2
  336. package/lib/esm/duet-divider_2.entry.js +1 -1
  337. package/lib/esm/duet-editable-table_3.entry.js +17 -14
  338. package/lib/esm/duet-empty-state.entry.js +1 -1
  339. package/lib/esm/duet-fieldset.entry.js +1 -1
  340. package/lib/esm/duet-footer.entry.js +1 -1
  341. package/lib/esm/duet-grid_2.entry.js +2 -2
  342. package/lib/esm/duet-header_2.entry.js +3 -3
  343. package/lib/esm/duet-hero.entry.js +1 -1
  344. package/lib/esm/duet-icon.entry.js +3 -3
  345. package/lib/esm/duet-input_2.entry.js +1 -1
  346. package/lib/esm/duet-layout.entry.js +1 -1
  347. package/lib/esm/duet-list_2.entry.js +1 -1
  348. package/lib/esm/duet-modal.entry.js +2 -2
  349. package/lib/esm/duet-notification_2.entry.js +1 -1
  350. package/lib/esm/duet-number-input.entry.js +1 -1
  351. package/lib/esm/duet-pagination_2.entry.js +1 -1
  352. package/lib/esm/duet-progress.entry.js +1 -1
  353. package/lib/esm/duet-radio_2.entry.js +1 -1
  354. package/lib/esm/duet-range-slider.entry.js +2 -2
  355. package/lib/esm/duet-scrollable_3.entry.js +1 -1
  356. package/lib/esm/duet-select.entry.js +1 -1
  357. package/lib/esm/duet-step_2.entry.js +1 -1
  358. package/lib/esm/duet-textarea.entry.js +1 -1
  359. package/lib/esm/duet-toggle.entry.js +1 -1
  360. package/lib/esm/duet-tooltip.entry.js +1 -1
  361. package/lib/esm/duet-tray.entry.js +2 -2
  362. package/lib/esm/duet-upload-aria-status.entry.js +1 -1
  363. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  364. package/lib/esm/duet.js +1 -1
  365. package/lib/esm/focus-utils-236f580e.js +18 -0
  366. package/lib/esm/{index-f600b8dc.js → index-b601aac1.js} +1 -1
  367. package/lib/esm/loader.js +1 -1
  368. package/lib/esm/token-utils-ebf797ab.js +92 -0
  369. package/lib/esm/tokens-b9d87fda.js +459 -0
  370. package/lib/esm/{tokens.module-f4572ed7.js → tokens.module-385c4cf8.js} +12 -10
  371. package/lib/esm-es5/duet-action-button.entry.js +1 -1
  372. package/lib/esm-es5/duet-alert.entry.js +1 -1
  373. package/lib/esm-es5/duet-badge.entry.js +1 -1
  374. package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
  375. package/lib/esm-es5/duet-breadcrumbs.entry.js +1 -1
  376. package/lib/esm-es5/duet-button_2.entry.js +1 -1
  377. package/lib/esm-es5/duet-caption_4.entry.js +1 -1
  378. package/lib/esm-es5/duet-card.entry.js +1 -1
  379. package/lib/esm-es5/duet-checkbox.entry.js +1 -1
  380. package/lib/esm-es5/duet-choice_2.entry.js +1 -1
  381. package/lib/esm-es5/duet-collapsible.entry.js +2 -2
  382. package/lib/esm-es5/duet-combobox.entry.js +1 -1
  383. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  384. package/lib/esm-es5/duet-date-picker.entry.js +1 -1
  385. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  386. package/lib/esm-es5/duet-editable-table_3.entry.js +1 -1
  387. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  388. package/lib/esm-es5/duet-fieldset.entry.js +1 -1
  389. package/lib/esm-es5/duet-footer.entry.js +1 -1
  390. package/lib/esm-es5/duet-grid_2.entry.js +1 -1
  391. package/lib/esm-es5/duet-header_2.entry.js +1 -1
  392. package/lib/esm-es5/duet-hero.entry.js +1 -1
  393. package/lib/esm-es5/duet-icon.entry.js +1 -1
  394. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  395. package/lib/esm-es5/duet-layout.entry.js +1 -1
  396. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  397. package/lib/esm-es5/duet-modal.entry.js +1 -1
  398. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  399. package/lib/esm-es5/duet-number-input.entry.js +1 -1
  400. package/lib/esm-es5/duet-pagination_2.entry.js +1 -1
  401. package/lib/esm-es5/duet-progress.entry.js +1 -1
  402. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  403. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  404. package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
  405. package/lib/esm-es5/duet-select.entry.js +1 -1
  406. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  407. package/lib/esm-es5/duet-textarea.entry.js +2 -2
  408. package/lib/esm-es5/duet-toggle.entry.js +1 -1
  409. package/lib/esm-es5/duet-tooltip.entry.js +1 -1
  410. package/lib/esm-es5/duet-tray.entry.js +1 -1
  411. package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
  412. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  413. package/lib/esm-es5/duet.js +1 -1
  414. package/lib/esm-es5/{focus-utils-559691b3.js → focus-utils-236f580e.js} +1 -1
  415. package/lib/esm-es5/{index-f600b8dc.js → index-b601aac1.js} +1 -1
  416. package/lib/esm-es5/loader.js +1 -1
  417. package/lib/esm-es5/{token-utils-df78f4d8.js → token-utils-ebf797ab.js} +1 -1
  418. package/lib/esm-es5/tokens-b9d87fda.js +4 -0
  419. package/lib/esm-es5/{tokens.module-f4572ed7.js → tokens.module-385c4cf8.js} +1 -1
  420. package/lib/types/components/duet-upload/duet-upload.d.ts +8 -8
  421. package/lib/types/components.d.ts +4 -4
  422. package/package.json +5 -5
  423. package/lib/custom-elements-bundle/index.d.ts +0 -399
  424. package/lib/custom-elements-bundle/index.js +0 -14110
  425. package/lib/duet/p-6002f3d2.system.js +0 -4
  426. package/lib/duet/p-7c198c75.entry.js +0 -4
  427. package/lib/duet/p-a93a04b9.system.js +0 -4
  428. package/lib/duet/p-d1746325.js +0 -4
  429. package/lib/duet/p-f2ab3e5c.entry.js +0 -4
  430. package/lib/esm-es5/tokens-8ff8c570.js +0 -4
@@ -0,0 +1,1514 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { p as proxyCustomElement, H, c as createEvent, h as h$1, b as Host } from './p-3fc2d124.js';
5
+ import { i as inheritGlobalTheme } from './p-4ebf1618.js';
6
+ import { c as createID } from './p-c1325e35.js';
7
+ import { d as debounce } from './p-0b3f675e.js';
8
+ import { g as getLocaleString, s as sanitizeString } from './p-ede854e1.js';
9
+ import { p as parsePossibleJSON } from './p-5a9d75e1.js';
10
+ import { h } from './p-b9058029.js';
11
+ import { d as defineCustomElement$i } from './p-0a928609.js';
12
+ import { d as defineCustomElement$h } from './p-09ed1ffa.js';
13
+ import { d as defineCustomElement$g } from './p-ef8eff22.js';
14
+ import { d as defineCustomElement$f } from './p-e294c0fb.js';
15
+ import { d as defineCustomElement$e } from './p-e5c8a58f.js';
16
+ import { d as defineCustomElement$d } from './p-d96debb6.js';
17
+ import { d as defineCustomElement$c } from './p-e4d5fbc0.js';
18
+ import { d as defineCustomElement$b } from './p-7739604d.js';
19
+ import { d as defineCustomElement$a } from './p-16d518fd.js';
20
+ import { d as defineCustomElement$9 } from './p-4717744e.js';
21
+ import { d as defineCustomElement$8 } from './p-213ef84c.js';
22
+ import { d as defineCustomElement$7 } from './p-acdba2db.js';
23
+ import { d as defineCustomElement$6 } from './p-81c9b244.js';
24
+ import { d as defineCustomElement$5 } from './p-3d987b87.js';
25
+ import { d as defineCustomElement$4 } from './p-da03a443.js';
26
+ import { d as defineCustomElement$3 } from './p-08cfe544.js';
27
+ import { d as defineCustomElement$2 } from './p-b08e57cf.js';
28
+
29
+ const errorCodes = [
30
+ {
31
+ type: "default",
32
+ system_message: "unknown error",
33
+ message: {
34
+ fi: "Tapahtui tuntematon virhe, ole hyvä ja yritä uudelleen.",
35
+ sv: "Ett okänt fel uppstod, försök igen.",
36
+ en: "An unknown error occured, please try again."
37
+ }
38
+ },
39
+ {
40
+ type: "400",
41
+ system_message: "Bad Request: The server could not understand the request due to invalid syntax.",
42
+ message: {
43
+ fi: "Tiedostoa ei hyväksytty.",
44
+ sv: "Servern avvisade din fil.",
45
+ en: "The server rejected your file."
46
+ }
47
+ },
48
+ {
49
+ type: "401",
50
+ system_message: "Not Authenticated: The client must authenticate itself to get the requested response...",
51
+ message: {
52
+ fi: "Vain kirjautunut käyttäjä voi lähettää tiedostoja.",
53
+ sv: "Du måste vara inloggad för att ladda upp filer.",
54
+ en: "You need to be logged in to upload files."
55
+ }
56
+ },
57
+ {
58
+ type: "403",
59
+ system_message: "No Access: The client does not have access rights to the content.",
60
+ message: {
61
+ fi: "Ei oikeuksia lähettää tiedostoja.",
62
+ sv: "Du har inte rätt åtkomsträttigheter för att ladda upp filer.",
63
+ en: "You do not have the correct access rights to upload files."
64
+ }
65
+ },
66
+ {
67
+ type: "413",
68
+ system_message: "Payload too large",
69
+ message: {
70
+ fi: "Tiedosto oli liian vastaanotettavaksi.",
71
+ sv: "Filen var för stor för servern att hantera.",
72
+ en: "The file was to large for the server to handle."
73
+ }
74
+ },
75
+ {
76
+ type: "415",
77
+ system_message: "Unsupported media type",
78
+ message: {
79
+ fi: "Tiedoston tyyppi oli väärä.",
80
+ sv: "Servern avvisade filen eftersom den hade fel typ.",
81
+ en: "The server rejected the file because it had the wrong type."
82
+ }
83
+ },
84
+ {
85
+ type: "429",
86
+ system_message: "Too many request from same address",
87
+ message: {
88
+ fi: "Liian monta yritystä, ole hyvä ja yritä myöhemmin uudelleen.",
89
+ sv: "Servern har fått många förfrågningar från dig, försök igen senare.",
90
+ en: "The server has received to many request from you, please try again later."
91
+ }
92
+ },
93
+ {
94
+ type: "500",
95
+ system_message: "Internal Server Error",
96
+ message: {
97
+ fi: "Palvelin ilmoitti tuntemattomasta virheestä ja lataus epäonnistui.",
98
+ sv: "Servern rapporterade ett okänt fel och uppladdningen misslyckades.",
99
+ en: "The server reported an unknown error and the upload failed."
100
+ }
101
+ },
102
+ {
103
+ type: "duet-upload-100",
104
+ system_message: "File extension not allowed",
105
+ message: {
106
+ fi: "Tiedoston tyyppi ei ole sallittu.",
107
+ sv: "Du kan inte ladda upp filer av den type.",
108
+ en: "You cannot upload files with that extension."
109
+ }
110
+ },
111
+ {
112
+ type: "duet-upload-001",
113
+ system_message: "File transfer failed",
114
+ message: {
115
+ fi: "Tiedoston lähetys keskeytyi, ole hyvä ja yritä uudelleen.",
116
+ sv: "Din anslutning till servern avbröts, försök igen.",
117
+ en: "Your connection to the server was interrupted, try again."
118
+ }
119
+ },
120
+ {
121
+ type: "duet-upload-101",
122
+ system_message: "File mimetype not allowed",
123
+ message: {
124
+ fi: "Tiedoston tyyppi ei ole sallittu.",
125
+ sv: "Du kan inte ladda upp filer av den typ.",
126
+ en: "You cannot upload files of that type."
127
+ }
128
+ },
129
+ {
130
+ type: "duet-upload-201",
131
+ system_message: "File is too large",
132
+ message: {
133
+ fi: "Tiedosto on liian iso.",
134
+ sv: "Filen är större än tillåtet.",
135
+ en: "The file is larger than permitted."
136
+ }
137
+ },
138
+ {
139
+ type: "duet-upload-202",
140
+ system_message: "The combined size of all files is too large",
141
+ message: {
142
+ fi: "Tiedostojen yhteenlaskettu koko on liian iso.",
143
+ sv: "Du har nått den maximala kombinerade filstorleken.",
144
+ en: "You have reached the maximum combined filesize."
145
+ }
146
+ },
147
+ {
148
+ type: "duet-upload-301",
149
+ system_message: "The maximum file limit has been reached",
150
+ message: {
151
+ fi: "Liitteiden maksimimäärä saavutettu.",
152
+ sv: "Maximalt antal bilagor har uppnåtts.",
153
+ en: "Maximum number of attachments reached."
154
+ }
155
+ }
156
+ ];
157
+
158
+ const getError = (code, errorCodes) => {
159
+ let error = {
160
+ type: undefined,
161
+ system_message: undefined,
162
+ message: undefined,
163
+ };
164
+ errorCodes = parsePossibleJSON(errorCodes);
165
+ error = errorCodes.filter(errorItem => {
166
+ // the == is intentional we may be comparing numbers to strings - and that is ok here
167
+ return errorItem.type == code;
168
+ })[0];
169
+ if (!error) {
170
+ error = errorCodes.filter(errorItem => {
171
+ return errorItem.type === "default";
172
+ })[0];
173
+ }
174
+ return error;
175
+ };
176
+ const getI18nError = (errorCode, errorCodes) => {
177
+ const errorFromJson = getError(errorCode, errorCodes);
178
+ const i18String = getLocaleString(errorFromJson.message);
179
+ if (i18String === "" || !i18String) {
180
+ return errorFromJson.system_message;
181
+ }
182
+ else {
183
+ return i18String;
184
+ }
185
+ };
186
+
187
+ const ErrorItem = ({ data, errorCodes }) => {
188
+ const { item, error } = data;
189
+ const { name } = item;
190
+ const { type } = error;
191
+ return (h("span", { class: "duet-upload-item-error", role: "status" },
192
+ h("duet-paragraph", { class: "duet-upload-item-name", color: "danger", margin: "none", weight: "semi-bold" },
193
+ h("duet-icon", { margin: "none", size: "x-small", name: "messaging-attachment" }),
194
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
195
+ name),
196
+ h("duet-paragraph", { class: "duet-upload-item-error-label", size: "small", margin: "none", color: "danger" }, getI18nError(type, errorCodes))));
197
+ };
198
+
199
+ const ProgressItem = ({ progress, name }) => (h("span", { class: "duet-upload-item-name" },
200
+ h("duet-icon", { margin: "none", size: "x-small", name: "messaging-attachment" }),
201
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
202
+ name,
203
+ h("br", null),
204
+ h("duet-progress", { progress: Math.ceil(progress), "aria-hidden": true })));
205
+
206
+ const PendingItem = ({ name }) => (h("span", { class: "duet-upload-item-name" },
207
+ h("duet-icon", { margin: "none", size: "x-small", name: "messaging-attachment" }),
208
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
209
+ name));
210
+
211
+ const formatBytes = (bytes, decimals = 2) => {
212
+ if (bytes === 0) {
213
+ return "0 Bytes";
214
+ }
215
+ const k = 1024;
216
+ const dm = decimals < 0 ? 0 : decimals;
217
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
218
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
219
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
220
+ };
221
+
222
+ const SuccessItem = ({ data, showLinks }) => {
223
+ const { item, size, uploaded, url, meta } = data;
224
+ const { name } = item;
225
+ const ContentName = (h("span", { class: "duet-upload-item-name" },
226
+ h("duet-icon", { margin: "none", size: "x-small", name: "messaging-attachment" }),
227
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
228
+ name));
229
+ const SizeText = (h("span", { class: "duet-upload-item-size", style: { fontSize: "14px", fontWeight: "400" } },
230
+ "(",
231
+ formatBytes(size),
232
+ ")"));
233
+ const FilenameLine = uploaded && url && showLinks ? (h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
234
+ h("duet-link", { url: url, external: true }, ContentName),
235
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
236
+ SizeText)) : (h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
237
+ ContentName,
238
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
239
+ SizeText));
240
+ const Badges = meta && meta.badges ? (h("span", null,
241
+ h("duet-spacer", { size: "xx-small" }),
242
+ meta.badges.map(badgeText => (h("duet-badge", { color: "primary" }, badgeText))))) : undefined;
243
+ return (h("span", { class: "duet-upload-item-success" },
244
+ h("div", null, FilenameLine),
245
+ Badges));
246
+ };
247
+
248
+ const validateFileExtension = (name, allowedExtensions) => {
249
+ if (!allowedExtensions) {
250
+ return true;
251
+ }
252
+ const ext = name.split(".");
253
+ const validExtension = allowedExtensions.split(",");
254
+ const extension = ext[ext.length - 1];
255
+ return validExtension.includes(extension);
256
+ };
257
+ const validateFileMime = (type, allowedMimetypes) => {
258
+ if (!allowedMimetypes || !type) {
259
+ return true;
260
+ }
261
+ const validMimeTypes = allowedMimetypes.split(",");
262
+ let valid = false;
263
+ validMimeTypes.forEach(mimeType => {
264
+ const allowedTypes = mimeType.split("/");
265
+ const fileType = type.split("/");
266
+ if (allowedTypes[0] === fileType[0] && (allowedTypes[1] === fileType[1] || allowedTypes[1] === "*")) {
267
+ valid = true;
268
+ }
269
+ });
270
+ return valid;
271
+ };
272
+ const validateFileSize = (size, maxBytes) => {
273
+ if (!maxBytes || !size) {
274
+ return true;
275
+ }
276
+ return maxBytes >= size;
277
+ };
278
+ const validateFile = (item, validators, errorCodes) => {
279
+ const { allowedMimetypes, allowedExtensions, maxBytes } = validators;
280
+ let valid = false;
281
+ let errorMessage = getError("default", errorCodes);
282
+ if (item) {
283
+ const { name, type, size } = item;
284
+ const mime = validateFileMime(type, allowedMimetypes);
285
+ const ext = allowedExtensions === "all" ||
286
+ allowedExtensions === "" ||
287
+ allowedExtensions === " " ||
288
+ allowedExtensions === undefined
289
+ ? true
290
+ : validateFileExtension(name.toLowerCase(), allowedExtensions);
291
+ const bytes = validateFileSize(size, maxBytes);
292
+ if (!mime) {
293
+ errorMessage = getError("duet-upload-101", errorCodes);
294
+ }
295
+ if (!ext) {
296
+ errorMessage = getError("duet-upload-100", errorCodes);
297
+ }
298
+ if (!bytes) {
299
+ errorMessage = getError("duet-upload-201", errorCodes);
300
+ }
301
+ valid = mime && ext && bytes;
302
+ }
303
+ else {
304
+ valid = false;
305
+ }
306
+ return {
307
+ valid,
308
+ errorMessage: valid ? undefined : getLocaleString(errorMessage.message),
309
+ errorSystem: valid ? undefined : errorMessage.system_message,
310
+ errorType: valid ? undefined : errorMessage.type,
311
+ };
312
+ };
313
+ const validateTotalSizeIsAboveMax = (filelist, maxTotalBytes) => {
314
+ let total = 0;
315
+ if (maxTotalBytes) {
316
+ filelist.forEach(item => {
317
+ if (item.valid && item.size) {
318
+ total += item.size;
319
+ }
320
+ });
321
+ if (total > maxTotalBytes) {
322
+ return true;
323
+ }
324
+ }
325
+ return false;
326
+ };
327
+ const validateTotalAmountIsAboveMax = (filelist, maxFiles) => {
328
+ let total = 0;
329
+ if (maxFiles) {
330
+ filelist.forEach(item => {
331
+ if (item.valid) {
332
+ total++;
333
+ }
334
+ });
335
+ if (total > maxFiles) {
336
+ return true;
337
+ }
338
+ }
339
+ return false;
340
+ };
341
+
342
+ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress }) => {
343
+ // @ts-ignore
344
+ const { type = "POST", xhr, uri, argument = null, headers = null } = options;
345
+ xhr.open(type, `${uri}${argument || ""}`, true);
346
+ const { data, name } = payload;
347
+ // headers must be added after open
348
+ if (headers) {
349
+ Object.keys(headers).forEach(key => {
350
+ xhr.setRequestHeader(key, headers[key]);
351
+ });
352
+ }
353
+ if (type === "POST") {
354
+ xhr.onreadystatechange = () => {
355
+ // Call a function when the state changes.
356
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status < 300) {
357
+ // Request finished without errors
358
+ onSuccess(xhr, name, xhr.status);
359
+ }
360
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 300 && xhr.status < 999) {
361
+ // Request finished with errors
362
+ onFailure(xhr, name, xhr.status);
363
+ }
364
+ };
365
+ onProgress(name);
366
+ }
367
+ xhr.send(data);
368
+ return xhr;
369
+ };
370
+
371
+ 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}.duet-upload-filelist-empty-label{font-size:1rem;font-weight:400}.duet-upload-editable-table-header-hidden{display:none}.duet-upload-editable-table tbody .duet-upload-editable-table-data{padding:0 !important;border:0}.duet-upload-editable-table duet-editable-table tfoot,.duet-upload-editable-table duet-editable-table thead{display:none}.duet-upload-editable-table duet-editable-table .duet-editable-table-content{padding-right:0 !important;padding-left:0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td{padding:1rem 0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td:last-child{padding-right:0 !important}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress,.duet-upload-editable-table duet-editable-table .duet-editable-table-row-pending{position:relative}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress duet-progress,.duet-upload-editable-table duet-editable-table .duet-editable-table-row-pending duet-progress{position:absolute;bottom:0;width:100%}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress duet-action-button::part(button),.duet-upload-editable-table duet-editable-table .duet-editable-table-row-pending duet-action-button::part(button){border:0}.duet-upload-editable-table .duet-upload-item-name duet-icon{position:relative;top:2px}duet-paragraph::part(duet-paragraph){word-break:break-word}";
372
+
373
+ const DuetUpload$1 = /*@__PURE__*/ proxyCustomElement(class extends H {
374
+ constructor() {
375
+ super();
376
+ this.__registerHost();
377
+ this.__attachShadow();
378
+ this.duetChange = createEvent(this, "duetChange", 3);
379
+ this.duetBlur = createEvent(this, "duetBlur", 7);
380
+ this.duetFocus = createEvent(this, "duetFocus", 7);
381
+ this.duetReady = createEvent(this, "duetReady", 7);
382
+ this.duetDone = createEvent(this, "duetDone", 3);
383
+ this.duetState = createEvent(this, "duetState", 3);
384
+ this.duetDelete = createEvent(this, "duetDelete", 3);
385
+ this.duetCancel = createEvent(this, "duetCancel", 3);
386
+ this.duetProgress = createEvent(this, "duetProgress", 3);
387
+ this.duetUpload = createEvent(this, "duetUpload", 3);
388
+ /**
389
+ * State() variables
390
+ */
391
+ this.tick = Date.now();
392
+ /**
393
+ * If external is set to true, the upload component will not actually upload the files, but only keep states
394
+ * it will be up to you to handle the upload and return progress information to the upload-component
395
+ */
396
+ this.external = false;
397
+ /**
398
+ * If internal upload method is used, and this has been set to a function - it will be called with the XHR options before the reqeust is sent, return an updated XHR options object in order to manipulate the request
399
+ */
400
+ this.middleware = null;
401
+ /**
402
+ * If defer-upload is true, duet-upload will not (as recommended) instantly upload files but await a call to uploadPending()
403
+ */
404
+ this.deferUpload = false;
405
+ /**
406
+ * If set the upload component will not display an upload button, you will have to create one yourself
407
+ * and call the exposed method startUpload to open the upload dialog
408
+ */
409
+ this.hideButton = false;
410
+ /**
411
+ * Default actions added to the internally used duet-editable-table
412
+ */
413
+ this.actions = [
414
+ {
415
+ icon: "action-delete",
416
+ color: "color-danger",
417
+ size: "x-small",
418
+ background: "gray-lightest",
419
+ name: "delete",
420
+ map: ["success", "failure"],
421
+ label: {
422
+ fi: "Poista tiedosto",
423
+ en: "Poista tiedosto",
424
+ sv: "Ta bort filen",
425
+ },
426
+ },
427
+ {
428
+ icon: "navigation-close",
429
+ color: "primary",
430
+ size: "x-small",
431
+ background: "gray-lightest",
432
+ name: "cancel",
433
+ map: ["inprogress", "pending"],
434
+ label: {
435
+ fi: "Keskeytä lähetys",
436
+ en: "Cancel the upload",
437
+ sv: "Stop överföringen",
438
+ },
439
+ },
440
+ ];
441
+ /**
442
+ * If enabled the editable-table will display links on successfully uploaded items,
443
+ * this requires the server can respond with link URIs in the correct format
444
+ * and that the files are accessible to the user
445
+ */
446
+ this.showLinks = false;
447
+ /**
448
+ * Property to change the aria upload progress text read aloud by screenreaders
449
+ * @default {
450
+ * fi: {
451
+ * inProgress: "Lähetetään {filesUploaded} lähetettävästä {filesTotal} tiedostosta",
452
+ * inProgressWithErrors:
453
+ * "Lähetetään {filesInProgress} tiedostoa, lähetetty {filesUploaded} lähetettävästä {filesTotal} tiedostosta, {filesWithErrors} tiedostossa on virheitä",
454
+ * done: "Kaikki {filesTotal} tiedostoa lähetetty onnistuneesti",
455
+ * doneWithErrors:
456
+ * "Lähetys valmis, {filesUploaded} tiedostoa on lähetetty onnistuneesti, {filesWithErrors} tiedostossa oli virheitä",
457
+ * files: "tiedostot",
458
+ * file: "tiedosto",
459
+ * },
460
+ * sv: {
461
+ * inProgress: "Adding {filesUploaded} of {filesTotal}",
462
+ * inProgressWithErrors:
463
+ * "Laddar upp {filesInProgress}, {filesUploaded} uppladdad av {filesTotal}, {filesWithErrors} misslyckades",
464
+ * done: "Alla {filesTotal} har lagts till",
465
+ * doneWithErrors: "Handling slutförd, {filesUploaded} har lagts till, {filesWithErrors} misslyckades",
466
+ * files: "filer",
467
+ * file: "fil",
468
+ * },
469
+ * en: {
470
+ * inProgress: "Adding {filesUploaded} of {filesTotal}",
471
+ * inProgressWithErrors:
472
+ * "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
473
+ * done: "All {filesTotal} added successfully",
474
+ * doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
475
+ * files: "tiedostoa",
476
+ * file: "tiedosto",
477
+ * },
478
+ * }
479
+ */
480
+ this.statusLabelDefaults = {
481
+ fi: {
482
+ inProgress: "Lähetetään {filesUploaded} lähetettävästä {filesTotal} tiedostosta",
483
+ inProgressWithErrors: "Lähetetään {filesInProgress} tiedostoa, lähetetty {filesUploaded} lähetettävästä {filesTotal} tiedostosta, {filesWithErrors} tiedostossa on virheitä",
484
+ done: "Kaikki {filesTotal} tiedostoa lähetetty onnistuneesti",
485
+ doneWithErrors: "Lähetys valmis, {filesUploaded} tiedostoa on lähetetty onnistuneesti, {filesWithErrors} tiedostossa oli virheitä",
486
+ files: "tiedostot",
487
+ file: "tiedosto",
488
+ },
489
+ sv: {
490
+ inProgress: "Adding {filesUploaded} of {filesTotal}",
491
+ inProgressWithErrors: "Laddar upp {filesInProgress}, {filesUploaded} uppladdad av {filesTotal}, {filesWithErrors} misslyckades",
492
+ done: "Alla {filesTotal} har lagts till",
493
+ doneWithErrors: "Handling slutförd, {filesUploaded} har lagts till, {filesWithErrors} misslyckades",
494
+ files: "filer",
495
+ file: "fil",
496
+ },
497
+ en: {
498
+ inProgress: "Adding {filesUploaded} of {filesTotal}",
499
+ inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
500
+ done: "All {filesTotal} added successfully",
501
+ doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
502
+ files: "File",
503
+ file: "file",
504
+ },
505
+ };
506
+ /**
507
+ * Strings used for the status aria-label
508
+ */
509
+ this.statusMessageLabel = getLocaleString(this.statusLabelDefaults);
510
+ /**
511
+ * Property to change button label defaults on the component.
512
+ * @default {
513
+ fi: "Lisää liite",
514
+ sv: "Lägg till en bilaga",
515
+ en: "Add an attachment",
516
+ }
517
+ */
518
+ this.buttonLabelDefaults = {
519
+ fi: "Lisää liite",
520
+ sv: "Lägg till en bilaga",
521
+ en: "Add an attachment",
522
+ };
523
+ /**
524
+ * Label of button
525
+ * @default { fi: "Lisää liite", sv: "Lägg till en bilaga", en: "Add an attachment" }
526
+ */
527
+ this.buttonLabel = getLocaleString(this.buttonLabelDefaults);
528
+ /**
529
+ * accessible aria-Label of button
530
+ */
531
+ this.accessibleButtonLabel = undefined;
532
+ /**
533
+ * Theme of the input.
534
+ */
535
+ this.theme = "";
536
+ /**
537
+ * Makes the input component disabled. This prevents users from being able to
538
+ * interact with the upload component, and conveys its inactive state to assistive technologies.
539
+ */
540
+ this.disabled = false;
541
+ /**
542
+ * Controls the margin of the component.
543
+ */
544
+ this.margin = "auto";
545
+ /**
546
+ * Set whether the input is required or not. Please note that this is necessary for
547
+ * accessible inputs when the user is required to fill them. When using this property
548
+ * you need to also set “novalidate” attribute to your form element to prevent
549
+ * browser from displaying its own validation errors.
550
+ */
551
+ this.required = false;
552
+ /**
553
+ * Key used to set vertical alignment of action buttons
554
+ */
555
+ this.alignment = "middle";
556
+ /**
557
+ * Visually hides the groups labels in the editable table list used to display the list of files
558
+ */
559
+ this.hideGroups = false;
560
+ /**
561
+ * Map of string that contain list of uploaded files.
562
+ */
563
+ this.files = new Map();
564
+ /**
565
+ * Property to read if the internally used editable-table contains errors or not
566
+ */
567
+ this.valid = !this.required;
568
+ /**
569
+ * Property to change labelDefaults defaults on the component.
570
+ * normally you would handle these strings on an application level and override @label when needed
571
+ * @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
572
+ */
573
+ this.labelDefaults = {
574
+ fi: "Lisää liite",
575
+ sv: "Lägg till en bilaga",
576
+ en: "Add attachments",
577
+ };
578
+ /**
579
+ * Label for the input.
580
+ * @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
581
+ */
582
+ this.label = getLocaleString(this.labelDefaults);
583
+ /**
584
+ * Property to change descriptionDefaults defaults on the component.
585
+ * @default {
586
+ * en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytestotal} of files at a time, and add up to {maxfiles} attachments at a time each no larger than {maxbytes}.",
587
+ * sv: "Du kan bifoga följande filtyper: {filetypes} - samt de vanligaste videofilerna. Du kan ladda upp {maxbytestotal} av filer åt gången, och lägga till upp till {maxfiles} bilagor åt gången varje inte större än {maxbytes}.",
588
+ * fi: "Voit liittää seuraavat tiedostotyypit: {filetypes} - sekä yleisimmät videotiedostot. Voit lähettää {maxbytestotal} tiedostoa kerrallaan, ja lisätä enintään {maxfiles} liitettä kerrallaan, jokainen enintään {maxbytes} kokoisena.",
589
+ * }
590
+ */
591
+ this.descriptionDefaults = {
592
+ en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytestotal} of files at a time, and add up to {maxfiles} attachments at a time each no larger than {maxbytes}.",
593
+ sv: "Du kan bifoga följande filtyper: {filetypes} - samt de vanligaste videofilerna. Du kan ladda upp {maxbytestotal} av filer åt gången, och lägga till upp till {maxfiles} bilagor åt gången varje inte större än {maxbytes}.",
594
+ fi: "Voit liittää seuraavat tiedostotyypit: {filetypes} - sekä yleisimmät videotiedostot. Voit lähettää {maxbytestotal} tiedostoa kerrallaan, ja lisätä enintään {maxfiles} liitettä kerrallaan, jokainen enintään {maxbytes} kokoisena.",
595
+ };
596
+ /**
597
+ * Description for the upload component.
598
+ * @default {
599
+ * en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytestotal} of files at a time, and add up to {maxfiles} attachments at a time each no larger than {maxbytes}.",
600
+ * sv: "Du kan bifoga följande filtyper: {filetypes} - samt de vanligaste videofilerna. Du kan ladda upp {maxbytestotal} av filer åt gången, och lägga till upp till {maxfiles} bilagor åt gången varje inte större än {maxbytes}.",
601
+ * fi: "Voit liittää seuraavat tiedostotyypit: {filetypes} - sekä yleisimmät videotiedostot. Voit lähettää {maxbytestotal} tiedostoa kerrallaan, ja lisätä enintään {maxfiles} liitettä kerrallaan, jokainen enintään {maxbytes} kokoisena.",
602
+ * }
603
+ */
604
+ this.description = getLocaleString(this.descriptionDefaults);
605
+ /**
606
+ * Defaults for the filelist's empty state.
607
+ * @default {
608
+ fi: "Ei vielä lisättyjä tiedostoja.",
609
+ sv: "Inga filer har lagts till ännu.",
610
+ en: "No files added yet.",
611
+ }
612
+ */
613
+ this.fileListEmptyDefaults = {
614
+ fi: "Ei vielä lisättyjä tiedostoja.",
615
+ sv: "Inga filer har lagts till ännu.",
616
+ en: "No files added yet.",
617
+ };
618
+ /**
619
+ * Label for the filelist's empty state.
620
+ * @default { fi: "Ei vielä lisättyjä tiedostoja.",sv: "Inga filer har lagts till ännu.",en: "No files added yet."}
621
+ */
622
+ this.fileListEmpty = getLocaleString(this.fileListEmptyDefaults);
623
+ /**
624
+ * Display the input in error state along with an error message.
625
+ */
626
+ this.error = "";
627
+ /**
628
+ * Default errorcodes used by the component, modifiable via javascript
629
+ */
630
+ this.errorCodes = errorCodes;
631
+ /**
632
+ * Use maxBytes to specify the maximum size in Bytes of a file that can be uploaded.
633
+ */
634
+ this.maxBytes = 200000000;
635
+ /**
636
+ * Use maxBytesTotal to specify the maximum size in Bytes of All files combined that can be uploaded.
637
+ */
638
+ this.maxBytesTotal = undefined;
639
+ /**
640
+ * Use maxFiles to specify the maximum amount of files that can be uploaded
641
+ */
642
+ this.maxFiles = 99;
643
+ /**
644
+ * A string of commaseperated file type values that are allowed
645
+ * @example: .pdf,.doc,.docx
646
+ */
647
+ this.allowedExtensions = "all";
648
+ /**
649
+ * A string of commaseperated mime type values that are allowed
650
+ * @example: image/*,application/msword,
651
+ */
652
+ this.allowedMimetypes = "*";
653
+ /**
654
+ * Use multiple to allow the user to select multiple files when uploading
655
+ */
656
+ this.multiple = true;
657
+ /**
658
+ * Use limitSelection to enforce the value in allowedExtension & allowedMimetypes when selecting files,
659
+ * by default this is off, setting this to true will limit the users choices to what has been explicitly set
660
+ */
661
+ this.limitSelection = false;
662
+ /**
663
+ * Own Properties
664
+ */
665
+ this.buttonId = createID("DuetButton");
666
+ this.labelId = createID("DuetLabel");
667
+ this.uploadId = createID("DuetUpload");
668
+ this.filesInProgress = new Map();
669
+ this.fileMaxReached = false;
670
+ this.bytesMaxReached = false;
671
+ this.internalStatusMessageLabel = undefined;
672
+ /**
673
+ * Properties
674
+ */
675
+ this.DefaultGroups = {
676
+ inprogress: "inprogress",
677
+ success: "success",
678
+ pending: "pending",
679
+ failure: "failure",
680
+ };
681
+ /**
682
+ * Array of group names that you want the editable table to use to display files
683
+ * @required
684
+ * @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
685
+ */
686
+ this.groups = [
687
+ {
688
+ id: this.DefaultGroups.pending,
689
+ label: {
690
+ en: "Files to upload",
691
+ sv: "Filer att ladda",
692
+ fi: "Ladattavat tiedostot",
693
+ },
694
+ },
695
+ {
696
+ id: this.DefaultGroups.success,
697
+ label: {
698
+ fi: "Valmiit tiedostot",
699
+ sv: "Files success",
700
+ en: "Files success",
701
+ },
702
+ },
703
+ {
704
+ id: this.DefaultGroups.failure,
705
+ label: {
706
+ fi: "Tiedostot, joissa on virheitä",
707
+ sv: "Filer med fel",
708
+ en: "Files with errors",
709
+ },
710
+ },
711
+ {
712
+ id: this.DefaultGroups.inprogress,
713
+ label: {
714
+ fi: "Kesken olevat tiedostot",
715
+ sv: "Filer inprogress",
716
+ en: "Files inprogress",
717
+ },
718
+ },
719
+ ];
720
+ this.kick = debounce(() => {
721
+ this.tick = Date.now();
722
+ }, 30); // will trigger re-render
723
+ /**
724
+ * Private functions
725
+ */
726
+ this.listenForActionEvents = () => {
727
+ this.element.addEventListener("duetActionEvent", (e) => {
728
+ const detail = e.detail;
729
+ const { action, id, originalEvent } = detail;
730
+ switch (action) {
731
+ case "delete":
732
+ this.onDelete(id, originalEvent);
733
+ break;
734
+ case "cancel":
735
+ this.onCancel(id, originalEvent);
736
+ break;
737
+ // code block
738
+ }
739
+ });
740
+ };
741
+ this.verifyValidity = () => {
742
+ const { invalid, valid } = this.getFilesAsArray();
743
+ const oldValid = this.valid;
744
+ this.valid = invalid.length === 0 && valid.length !== 0;
745
+ if (this.valid !== oldValid) {
746
+ this.duetState.emit({
747
+ originalEvent: undefined,
748
+ data: { valid: this.valid, from: "componentWillRender" },
749
+ component: "duet-upload",
750
+ });
751
+ }
752
+ };
753
+ this.getGroupFromItemData = (item) => {
754
+ if (item.valid && item.progress === 100) {
755
+ // if the item has a group, move the file to that group instead
756
+ // of into the standard success group
757
+ return this.DefaultGroups.success;
758
+ }
759
+ else if (item.progress > 0 && item.progress !== 100) {
760
+ return this.DefaultGroups.inprogress;
761
+ }
762
+ else if (!item.valid) {
763
+ return this.DefaultGroups.failure;
764
+ }
765
+ else if (item.pending) {
766
+ return this.DefaultGroups.pending;
767
+ }
768
+ else if (item.group) {
769
+ return item.group;
770
+ }
771
+ else {
772
+ return "none";
773
+ }
774
+ };
775
+ this.getItemHTMLFromItemData = (data, group) => {
776
+ if (group === this.DefaultGroups.success) {
777
+ return h$1(SuccessItem, { data: data, showLinks: this.showLinks });
778
+ }
779
+ else if (group === this.DefaultGroups.inprogress) {
780
+ return h$1(ProgressItem, { progress: data.progress, name: data.item.name });
781
+ }
782
+ else if (group === this.DefaultGroups.pending) {
783
+ return h$1(PendingItem, { name: data.item.name });
784
+ }
785
+ else if (group === this.DefaultGroups.failure) {
786
+ return h$1(ErrorItem, { data: data, errorCodes: this.errorCodes });
787
+ }
788
+ else if (data.group) {
789
+ return data.html;
790
+ }
791
+ else {
792
+ return "none";
793
+ }
794
+ };
795
+ this.genHashName = () => Date.now().toString(36) + Math.random();
796
+ this.updateValueInMap = (item, key, value, kick = true) => {
797
+ try {
798
+ const fileItem = this.files.get(item);
799
+ fileItem[key] = value;
800
+ this.files.set(item, fileItem);
801
+ }
802
+ catch (e) {
803
+ // if a users tries to update entries on a file that doesn't exist,
804
+ // this will blow up - so we're swallowing the errors here on purpose
805
+ // console.warn("operation on missing items")
806
+ }
807
+ if (kick) {
808
+ this.kick();
809
+ }
810
+ };
811
+ this.updateProgress = (ev, name) => {
812
+ const updateProgressHelper = percentComplete => {
813
+ this.updateValueInMap(name, "progress", percentComplete);
814
+ this.onProgress(name, percentComplete, ev);
815
+ };
816
+ if (ev.lengthComputable) {
817
+ const percentComplete = (ev.loaded / ev.total) * 100;
818
+ updateProgressHelper(percentComplete);
819
+ }
820
+ else {
821
+ console.log("cant read progress");
822
+ }
823
+ };
824
+ this.trackProgress = (name, remove = false) => {
825
+ if (remove) {
826
+ this.filesInProgress.delete(name);
827
+ }
828
+ else {
829
+ this.filesInProgress.set(name, "inprogress");
830
+ }
831
+ if (this.filesInProgress.size === 0) {
832
+ this.onDone();
833
+ }
834
+ };
835
+ this.getFilesAsArray = () => {
836
+ const filesInQueue = [];
837
+ const filesInError = [];
838
+ this.files.forEach(value => {
839
+ if (value.valid && !value.deleted) {
840
+ filesInQueue.push(value);
841
+ }
842
+ else if (!value.valid && !value.deleted) {
843
+ filesInError.push(value);
844
+ }
845
+ });
846
+ return { valid: filesInQueue, invalid: filesInError };
847
+ };
848
+ this.resetFormFields = () => {
849
+ /**
850
+ * You cannot modify a FileList, nor remove single items from it
851
+ * This completely removes all items in the FileList
852
+ * We reset the form fields to always be able to re-upload files
853
+ * and because we handle all uploads and states internally in the component (not relying on native form elements)
854
+ */
855
+ /* TODO: it may be a good idea to just update the list so that this always matches what is in the files map,
856
+ * TODO: this would remove the capability of Re-uploading, unless we can catch and remove the user file from the form filelist before the upload is canceled by the browser
857
+ * TODO: but for now we'll just reset the form fields
858
+ */
859
+ this.nativeInput.value = "";
860
+ };
861
+ this.startUpload = async (ev, metaData = undefined) => {
862
+ this.metaData = metaData;
863
+ this.nativeInput.click();
864
+ this.onUpload(ev, metaData);
865
+ ev.stopPropagation();
866
+ ev.preventDefault();
867
+ return;
868
+ };
869
+ /**
870
+ * Eventlisteners for the XHR requests
871
+ */
872
+ this.transferComplete = name => {
873
+ this.updateValueInMap(name, "progress", 100, false);
874
+ this.trackProgress(name, true);
875
+ };
876
+ this.transferDone = (xhr, name, status) => {
877
+ this.updateValueInMap(name, "status", status, false);
878
+ this.updateValueInMap(name, "uploaded", true, false);
879
+ try {
880
+ const response = JSON.parse(xhr.response);
881
+ this.updateValueInMap(name, "url", response.url);
882
+ }
883
+ catch (e) {
884
+ this.updateValueInMap(name, "url", null);
885
+ console.error("Server did not respond with expected response {url: string}");
886
+ }
887
+ return;
888
+ };
889
+ this.transferDoneWithFailure = (xhr, name, status) => {
890
+ try {
891
+ const { error } = JSON.parse(xhr.response);
892
+ this.updateValueInMap(name, "error", { message: error.message, type: error.type }, false);
893
+ }
894
+ catch (e) {
895
+ console.error("Server did not respond with expected response error:{message: string, type: int}");
896
+ this.updateValueInMap(name, "error", { type: status }, false);
897
+ }
898
+ this.updateValueInMap(name, "valid", false, true);
899
+ };
900
+ this.transferFailed = name => {
901
+ this.updateValueInMap(name, "error", getI18nError("duet-upload-001", this.errorCodes));
902
+ };
903
+ this.transferCanceled = name => {
904
+ this.files.delete(name);
905
+ this.validateTotals(name);
906
+ this.kick();
907
+ };
908
+ this.validateTotals = (name) => {
909
+ const isTotalSizeOverMaxSize = validateTotalSizeIsAboveMax(this.files, this.maxBytesTotal);
910
+ const isTotalFileAmountAboveMax = validateTotalAmountIsAboveMax(this.files, this.maxFiles);
911
+ if (isTotalSizeOverMaxSize && name) {
912
+ this.updateValueInMap(name, "error", getI18nError("duet-upload-202", this.errorCodes), false);
913
+ }
914
+ if (isTotalFileAmountAboveMax && name) {
915
+ this.updateValueInMap(name, "error", getI18nError("duet-upload-301", this.errorCodes), false);
916
+ }
917
+ this.bytesMaxReached = isTotalSizeOverMaxSize;
918
+ this.fileMaxReached = isTotalFileAmountAboveMax;
919
+ return {
920
+ bytesMaxReached: isTotalSizeOverMaxSize,
921
+ fileMaxReached: isTotalFileAmountAboveMax,
922
+ };
923
+ };
924
+ this.uploadFile = async (fileListItem, force = false, key) => {
925
+ if (!force && this.deferUpload) {
926
+ this.updateValueInMap(fileListItem.item.name, "pending", true, false);
927
+ this.updateValueInMap(fileListItem.item.name, "group", "pending", true);
928
+ }
929
+ else if (force) {
930
+ this.updateValueInMap(fileListItem.item.name, "pending", false, false);
931
+ this.updateValueInMap(fileListItem.item.name, "group", undefined, true);
932
+ }
933
+ try {
934
+ if (!this.deferUpload || force) {
935
+ // if all is well AND external file upload handling has not been set, start upload
936
+ const data = new FormData();
937
+ data.append("file", fileListItem.item);
938
+ if (key) {
939
+ data.append("key", key);
940
+ }
941
+ data.append("uid", fileListItem.uid);
942
+ data.append("name", fileListItem.item.name);
943
+ data.append("metadata", JSON.stringify({
944
+ uid: fileListItem.uid,
945
+ url: this.uri,
946
+ size: fileListItem.item.size,
947
+ meta: fileListItem.meta,
948
+ }));
949
+ fileListItem.xhr = await this.makeXHRPostRequest(data);
950
+ }
951
+ }
952
+ catch (e) {
953
+ // in case one of the global maxes have been reached, invalidate the file
954
+ this.updateValueInMap(fileListItem.item.name, "valid", false, false);
955
+ }
956
+ };
957
+ this.uploadPendingFiles = () => {
958
+ for (const [key, value] of this.files.entries()) {
959
+ if (value.group === "pending" && value.pending === true) {
960
+ this.uploadFile(value, true, key);
961
+ }
962
+ }
963
+ };
964
+ this.getItemFromUID = (uid) => {
965
+ for (const [key, value] of this.files.entries()) {
966
+ if (value.uid === uid) {
967
+ return { value, key };
968
+ }
969
+ }
970
+ return null;
971
+ };
972
+ this.onDelete = (key, ev) => {
973
+ const item = this.getItemFromUID(key);
974
+ const retrievedKey = item.key;
975
+ const deletedItem = this.files.get(retrievedKey);
976
+ this.files.delete(retrievedKey);
977
+ this.validateTotals();
978
+ this.kick();
979
+ this.duetDelete.emit({
980
+ originalEvent: ev,
981
+ data: { deletion: deletedItem },
982
+ component: "duet-upload",
983
+ });
984
+ // don't send a xhr request if the item was pending, just remove it from the list
985
+ if (!this.external && !deletedItem.pending) {
986
+ this.makeXHRDeleteRequest(deletedItem);
987
+ }
988
+ this.resetFormFields();
989
+ };
990
+ this.onCancel = (key, ev) => {
991
+ const retrievedKey = this.getItemFromUID(key).key;
992
+ const cancelledItem = this.files.get(retrievedKey);
993
+ this.files.delete(retrievedKey);
994
+ if (!this.external) {
995
+ const { xhr } = cancelledItem;
996
+ if (xhr) {
997
+ xhr.abort();
998
+ }
999
+ }
1000
+ else {
1001
+ this.kick();
1002
+ }
1003
+ this.resetFormFields();
1004
+ this.duetCancel.emit({
1005
+ originalEvent: ev,
1006
+ data: { cancelled: cancelledItem },
1007
+ component: "duet-upload",
1008
+ });
1009
+ };
1010
+ this.onUpload = (ev, metaData) => {
1011
+ this.duetUpload.emit({
1012
+ originalEvent: ev,
1013
+ metaData,
1014
+ component: "duet-upload",
1015
+ });
1016
+ };
1017
+ this.onBlur = (ev) => {
1018
+ this.duetBlur.emit({
1019
+ originalEvent: ev,
1020
+ component: "duet-upload",
1021
+ });
1022
+ };
1023
+ this.onProgress = (key, percentComplete, ev) => {
1024
+ this.duetChange.emit({
1025
+ originalEvent: ev,
1026
+ data: {
1027
+ key,
1028
+ percentComplete,
1029
+ },
1030
+ component: "duet-upload",
1031
+ });
1032
+ };
1033
+ this.onFocus = (ev) => {
1034
+ this.duetFocus.emit({
1035
+ originalEvent: ev,
1036
+ component: "duet-upload",
1037
+ });
1038
+ };
1039
+ this.onReady = () => {
1040
+ this.duetReady.emit({
1041
+ component: "duet-upload",
1042
+ });
1043
+ };
1044
+ this.onDone = () => {
1045
+ this.duetDone.emit({
1046
+ component: "duet-upload",
1047
+ data: { files: this.files },
1048
+ });
1049
+ };
1050
+ /**
1051
+ * @description This functions return sorted map items byg condition which are:
1052
+ */
1053
+ this.filterMap = () => {
1054
+ const all = [...this.files.values()];
1055
+ const inprogress = [];
1056
+ const failure = [];
1057
+ const pending = [];
1058
+ const success = [];
1059
+ all.forEach(data => {
1060
+ const group = this.getGroupFromItemData(data);
1061
+ const item = this.getItemHTMLFromItemData(data, group);
1062
+ if (group === this.DefaultGroups.success) {
1063
+ success.push({
1064
+ uid: data.uid,
1065
+ item,
1066
+ group,
1067
+ });
1068
+ }
1069
+ else if (group === this.DefaultGroups.inprogress) {
1070
+ inprogress.push({
1071
+ uid: data.uid,
1072
+ item,
1073
+ group,
1074
+ });
1075
+ }
1076
+ else if (group === this.DefaultGroups.pending) {
1077
+ pending.push({
1078
+ uid: data.uid,
1079
+ item,
1080
+ group,
1081
+ });
1082
+ }
1083
+ else if (group === this.DefaultGroups.failure) {
1084
+ failure.push({
1085
+ uid: data.uid,
1086
+ item,
1087
+ group,
1088
+ });
1089
+ }
1090
+ else if (data.group) {
1091
+ inprogress.push({
1092
+ uid: data.uid,
1093
+ item,
1094
+ group: data.group,
1095
+ });
1096
+ }
1097
+ });
1098
+ return {
1099
+ pending,
1100
+ failure,
1101
+ success,
1102
+ inprogress,
1103
+ };
1104
+ };
1105
+ this.getColumns = (group) => {
1106
+ return [
1107
+ {
1108
+ sort_order: 1,
1109
+ direction: -1,
1110
+ index: 0,
1111
+ key: group.id,
1112
+ label: group.label,
1113
+ },
1114
+ ];
1115
+ };
1116
+ this.getActions = (id) => {
1117
+ return this.actions.filter(item => item.map.includes(id));
1118
+ };
1119
+ this.renderEditableTableGroups = () => {
1120
+ const filteredItems = this.filterMap();
1121
+ const EditableTables = this.groups.map(group => {
1122
+ const currentItems = filteredItems[group.id];
1123
+ if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
1124
+ return;
1125
+ }
1126
+ return (h$1("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" }, h$1("table", { class: "duet-upload-editable-table" }, h$1("thead", { class: "duet-upload-editable-table-header" }, h$1("tr", null, h$1("th", { class: {
1127
+ "duet-upload-editable-table-header-hidden": this.hideGroups,
1128
+ } }, !this.hideGroups ? (getLocaleString(group.label)) : (h$1("duet-visually-hidden", null, getLocaleString(group.label)))))), h$1("tbody", null, h$1("tr", null, h$1("td", { class: "duet-upload-editable-table-data" }, h$1("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
1129
+ });
1130
+ return EditableTables;
1131
+ };
1132
+ }
1133
+ watchValidHandler(newValue, oldValue) {
1134
+ if (newValue !== oldValue) {
1135
+ this.kick();
1136
+ }
1137
+ }
1138
+ /**
1139
+ * Component lifecycle events.
1140
+ */
1141
+ componentWillLoad() {
1142
+ if (typeof this.statusMessageLabel === "string") {
1143
+ this.internalStatusMessageLabel = sanitizeString(this.groups);
1144
+ }
1145
+ else {
1146
+ this.internalStatusMessageLabel = this.statusMessageLabel;
1147
+ }
1148
+ inheritGlobalTheme(this);
1149
+ this.listenForActionEvents();
1150
+ this.onReady();
1151
+ }
1152
+ componentWillRender() {
1153
+ // listen to the events from the component
1154
+ this.verifyValidity();
1155
+ }
1156
+ /**
1157
+ * Sets focus on the specified `duet-input`. Use this method instead of the global
1158
+ * `input.focus()`.
1159
+ */
1160
+ async setFocus(options) {
1161
+ if (this.nativeInput) {
1162
+ this.nativeInput.focus(options);
1163
+ }
1164
+ return;
1165
+ }
1166
+ /**
1167
+ * Method for invoking the upload sequence
1168
+ */
1169
+ async upload(metaData = undefined) {
1170
+ await this.setFocus();
1171
+ this.metaData = metaData;
1172
+ this.nativeInput.click();
1173
+ return;
1174
+ }
1175
+ /**
1176
+ * Method for uploading pending files
1177
+ */
1178
+ async uploadPending() {
1179
+ this.uploadPendingFiles();
1180
+ }
1181
+ /**
1182
+ * Method for forcing a render of the upload list, element.files can be changed externally
1183
+ * But it will only rerender on a new Map or a top Level change - this can be used to update
1184
+ * the tabular data if the automatic re-render is no sufficient
1185
+ */
1186
+ async refresh() {
1187
+ this.kick();
1188
+ await this.setFocus();
1189
+ }
1190
+ /**
1191
+ * Get list of files, divided in errors and valid sections
1192
+ */
1193
+ async getFiles() {
1194
+ if (!this.files || this.files.size === 0) {
1195
+ return false;
1196
+ }
1197
+ return this.getFilesAsArray();
1198
+ }
1199
+ /**
1200
+ * Convenience method for updating the value of a key:value inside an item in the files attribute
1201
+ */
1202
+ async updateValue(item, key, value) {
1203
+ this.updateValueInMap(item, key, value);
1204
+ }
1205
+ /**
1206
+ * render() function
1207
+ * Always the last one in the class.
1208
+ */
1209
+ render() {
1210
+ const identifier = this.identifier || this.uploadId;
1211
+ const maxMegaBytesTotal = Math.round((this.maxBytesTotal ? this.maxBytesTotal : this.maxBytes * this.maxFiles) / 1024 / 1024);
1212
+ const maxMegaBytesPrFile = Math.round(this.maxBytes / 1024 / 1024);
1213
+ let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
1214
+ caption = caption.replace(/{maxbytes}/g, `${maxMegaBytesPrFile.toString()} MB`);
1215
+ caption = caption.replace(/{maxbytestotal}/g, `${maxMegaBytesTotal.toString()} MB`);
1216
+ caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
1217
+ return (h$1(Host, { class: { "duet-m-0": this.margin === "none" } }, h$1("duet-fieldset", { label: this.label, caption: caption }, h$1("slot", { name: "header" }), !this.files.size && (h$1("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
1218
+ "duet-upload-filelist-empty": !this.files.size,
1219
+ "duet-upload-filelist": true,
1220
+ "duet-upload-filelist-filled": this.files.size,
1221
+ }, id: this.labelId, for: identifier }, h$1("span", { class: {
1222
+ "duet-upload-filelist-empty-label": !this.files.size,
1223
+ } }, this.fileListEmpty))), !!this.files.size && h$1("slot", { name: "fileheader" }), !!this.files.size && (h$1("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && this.renderEditableTableGroups(), !!this.files.size && h$1("slot", { name: "filefooter" }), h$1("duet-spacer", { size: "large" }), !this.hideButton && (h$1("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", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), h$1("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (h$1("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301", this.errorCodes), this.bytesMaxReached && getI18nError("duet-upload-202", this.errorCodes))), h$1("duet-spacer", { size: "medium" }), h$1("duet-visually-hidden", null, h$1("input", { ref: input => {
1224
+ this.nativeInput = input;
1225
+ }, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
1226
+ "duet-upload": true,
1227
+ }, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
1228
+ }
1229
+ /**
1230
+ * XHR request utilities
1231
+ */
1232
+ makeXHRPostRequest(data) {
1233
+ const xhr = new XMLHttpRequest();
1234
+ const name = data.get("name");
1235
+ xhr.upload.addEventListener("progress", ev => {
1236
+ this.updateProgress(ev, name);
1237
+ });
1238
+ xhr.upload.addEventListener("load", () => {
1239
+ this.transferComplete(name);
1240
+ });
1241
+ xhr.upload.addEventListener("error", () => {
1242
+ this.transferFailed(name);
1243
+ });
1244
+ xhr.upload.addEventListener("abort", () => {
1245
+ this.transferCanceled(name);
1246
+ });
1247
+ let options = {
1248
+ payload: { data, name },
1249
+ options: { type: "POST", uri: this.uri, xhr, argument: null, headers: undefined },
1250
+ onFailure: this.transferDoneWithFailure,
1251
+ onSuccess: this.transferDone,
1252
+ onProgress: this.trackProgress,
1253
+ };
1254
+ if (this.middleware) {
1255
+ options = this.middleware(options);
1256
+ }
1257
+ return makeXhrRequest(options);
1258
+ }
1259
+ makeXHRDeleteRequest(data) {
1260
+ const { uid, item } = data;
1261
+ const xhr = new XMLHttpRequest();
1262
+ const headers = {
1263
+ "x-fileuid": uid,
1264
+ "x-filename": item.name,
1265
+ };
1266
+ let options = {
1267
+ payload: { data: null, name },
1268
+ options: {
1269
+ type: "DELETE",
1270
+ xhr,
1271
+ uri: this.uri,
1272
+ argument: `?key=${uid}&name=${item.name}`,
1273
+ headers,
1274
+ },
1275
+ onFailure: this.transferDoneWithFailure,
1276
+ onSuccess: this.transferDone,
1277
+ onProgress: this.trackProgress,
1278
+ };
1279
+ if (this.middleware) {
1280
+ options = this.middleware(options);
1281
+ }
1282
+ // don't present server issues to user on deletes, just remove them from the visible list
1283
+ return makeXhrRequest(options);
1284
+ }
1285
+ /**
1286
+ * Component event handling.
1287
+ */
1288
+ async onChange(ev) {
1289
+ var _a;
1290
+ const selectedFiles = Array.from((_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.files);
1291
+ // FileList is a nice array like structure but
1292
+ // to ensure uniqueness of files we use a mapping structure and
1293
+ // key to the name (makes it easier to delete as well)
1294
+ if (selectedFiles) {
1295
+ for (const item of selectedFiles) {
1296
+ const { valid, errorMessage, errorType, errorSystem } = validateFile(item, {
1297
+ maxBytes: this.maxBytes,
1298
+ allowedExtensions: this.allowedExtensions,
1299
+ allowedMimetypes: this.allowedMimetypes,
1300
+ }, this.errorCodes);
1301
+ const uid = this.genHashName();
1302
+ const fileListItem = {
1303
+ uid,
1304
+ item: item,
1305
+ size: item.size,
1306
+ meta: this.metaData,
1307
+ uploaded: false,
1308
+ valid,
1309
+ error: {
1310
+ type: valid ? undefined : errorType,
1311
+ message: valid ? undefined : errorMessage,
1312
+ system_message: valid ? undefined : errorSystem,
1313
+ },
1314
+ progress: 0,
1315
+ deleted: false,
1316
+ xhr: false,
1317
+ url: false,
1318
+ };
1319
+ this.files.set(item.name, fileListItem);
1320
+ // validate that we haven't hit any maxfiles or maxbytes limits before we upload
1321
+ const { bytesMaxReached, fileMaxReached } = this.validateTotals(item.name);
1322
+ if (bytesMaxReached) {
1323
+ // in case one of the global maxes have been reached, invalidate the file
1324
+ this.updateValueInMap(item.name, "valid", false, false);
1325
+ }
1326
+ else if (fileMaxReached) {
1327
+ // in case one of the global maxes have been reached, invalidate the file
1328
+ this.updateValueInMap(item.name, "valid", false, false);
1329
+ }
1330
+ else if (valid && !this.external) {
1331
+ await this.uploadFile(fileListItem);
1332
+ }
1333
+ else if (valid && this.external) {
1334
+ this.updateValueInMap(fileListItem.item.name, "pending", true, false);
1335
+ this.updateValueInMap(fileListItem.item.name, "group", "pending", true);
1336
+ }
1337
+ else if (!valid) {
1338
+ this.updateValueInMap(item.name, "valid", false, true);
1339
+ }
1340
+ // kick the stat to force update
1341
+ this.kick();
1342
+ }
1343
+ }
1344
+ // reset the form, so that a user may upload a file again (with the same name)
1345
+ this.resetFormFields();
1346
+ // reset the internal metaData state
1347
+ this.metaData = undefined;
1348
+ this.duetChange.emit({
1349
+ originalEvent: ev,
1350
+ data: { files: this.files },
1351
+ component: "duet-upload",
1352
+ });
1353
+ }
1354
+ get element() { return this; }
1355
+ static get watchers() { return {
1356
+ "valid": ["watchValidHandler"]
1357
+ }; }
1358
+ static get style() { return duetUploadCss; }
1359
+ }, [1, "duet-upload", {
1360
+ "accessibleActiveDescendant": [1, "accessible-active-descendant"],
1361
+ "accessibleDescribedBy": [1, "accessible-described-by"],
1362
+ "accessibleControls": [1, "accessible-controls"],
1363
+ "accessibleOwns": [1, "accessible-owns"],
1364
+ "external": [4],
1365
+ "middleware": [16],
1366
+ "deferUpload": [4, "defer-upload"],
1367
+ "hideButton": [4, "hide-upload-button"],
1368
+ "actions": [16],
1369
+ "uri": [1],
1370
+ "showLinks": [4, "show-links"],
1371
+ "caption": [1],
1372
+ "statusLabelDefaults": [1, "status-label-default"],
1373
+ "statusMessageLabel": [1, "status-message-label"],
1374
+ "buttonLabelDefaults": [1, "button-label-default"],
1375
+ "buttonLabel": [1, "button-label"],
1376
+ "accessibleButtonLabel": [1, "accessible-button-label"],
1377
+ "theme": [1025],
1378
+ "disabled": [516],
1379
+ "identifier": [1],
1380
+ "margin": [1],
1381
+ "required": [4],
1382
+ "alignment": [1],
1383
+ "hideGroups": [4, "hide-table-labels"],
1384
+ "files": [1040],
1385
+ "valid": [1540],
1386
+ "labelDefaults": [1, "label-default"],
1387
+ "label": [1],
1388
+ "descriptionDefaults": [1, "description-default"],
1389
+ "description": [1],
1390
+ "fileListEmptyDefaults": [1, "list-empty-default"],
1391
+ "fileListEmpty": [1, "file-list-empty"],
1392
+ "error": [1],
1393
+ "errorCodes": [16],
1394
+ "name": [1],
1395
+ "maxBytes": [2, "max-bytes"],
1396
+ "maxBytesTotal": [2, "max-bytes-total"],
1397
+ "maxFiles": [2, "max-files"],
1398
+ "allowedExtensions": [1, "allowed-extensions"],
1399
+ "allowedMimetypes": [1, "allowed-mimetypes"],
1400
+ "multiple": [4],
1401
+ "limitSelection": [4, "limit-selection"],
1402
+ "value": [1025],
1403
+ "groups": [16],
1404
+ "tick": [32],
1405
+ "setFocus": [64],
1406
+ "upload": [64],
1407
+ "uploadPending": [64],
1408
+ "refresh": [64],
1409
+ "getFiles": [64],
1410
+ "updateValue": [64]
1411
+ }]);
1412
+ function defineCustomElement$1() {
1413
+ if (typeof customElements === "undefined") {
1414
+ return;
1415
+ }
1416
+ const components = ["duet-upload", "duet-action-button", "duet-alert", "duet-badge", "duet-button", "duet-caption", "duet-editable-table", "duet-fieldset", "duet-icon", "duet-label", "duet-link", "duet-paragraph", "duet-progress", "duet-spacer", "duet-spinner", "duet-table", "duet-upload-aria-status", "duet-visually-hidden"];
1417
+ components.forEach(tagName => { switch (tagName) {
1418
+ case "duet-upload":
1419
+ if (!customElements.get(tagName)) {
1420
+ customElements.define(tagName, DuetUpload$1);
1421
+ }
1422
+ break;
1423
+ case "duet-action-button":
1424
+ if (!customElements.get(tagName)) {
1425
+ defineCustomElement$i();
1426
+ }
1427
+ break;
1428
+ case "duet-alert":
1429
+ if (!customElements.get(tagName)) {
1430
+ defineCustomElement$h();
1431
+ }
1432
+ break;
1433
+ case "duet-badge":
1434
+ if (!customElements.get(tagName)) {
1435
+ defineCustomElement$g();
1436
+ }
1437
+ break;
1438
+ case "duet-button":
1439
+ if (!customElements.get(tagName)) {
1440
+ defineCustomElement$f();
1441
+ }
1442
+ break;
1443
+ case "duet-caption":
1444
+ if (!customElements.get(tagName)) {
1445
+ defineCustomElement$e();
1446
+ }
1447
+ break;
1448
+ case "duet-editable-table":
1449
+ if (!customElements.get(tagName)) {
1450
+ defineCustomElement$d();
1451
+ }
1452
+ break;
1453
+ case "duet-fieldset":
1454
+ if (!customElements.get(tagName)) {
1455
+ defineCustomElement$c();
1456
+ }
1457
+ break;
1458
+ case "duet-icon":
1459
+ if (!customElements.get(tagName)) {
1460
+ defineCustomElement$b();
1461
+ }
1462
+ break;
1463
+ case "duet-label":
1464
+ if (!customElements.get(tagName)) {
1465
+ defineCustomElement$a();
1466
+ }
1467
+ break;
1468
+ case "duet-link":
1469
+ if (!customElements.get(tagName)) {
1470
+ defineCustomElement$9();
1471
+ }
1472
+ break;
1473
+ case "duet-paragraph":
1474
+ if (!customElements.get(tagName)) {
1475
+ defineCustomElement$8();
1476
+ }
1477
+ break;
1478
+ case "duet-progress":
1479
+ if (!customElements.get(tagName)) {
1480
+ defineCustomElement$7();
1481
+ }
1482
+ break;
1483
+ case "duet-spacer":
1484
+ if (!customElements.get(tagName)) {
1485
+ defineCustomElement$6();
1486
+ }
1487
+ break;
1488
+ case "duet-spinner":
1489
+ if (!customElements.get(tagName)) {
1490
+ defineCustomElement$5();
1491
+ }
1492
+ break;
1493
+ case "duet-table":
1494
+ if (!customElements.get(tagName)) {
1495
+ defineCustomElement$4();
1496
+ }
1497
+ break;
1498
+ case "duet-upload-aria-status":
1499
+ if (!customElements.get(tagName)) {
1500
+ defineCustomElement$3();
1501
+ }
1502
+ break;
1503
+ case "duet-visually-hidden":
1504
+ if (!customElements.get(tagName)) {
1505
+ defineCustomElement$2();
1506
+ }
1507
+ break;
1508
+ } });
1509
+ }
1510
+
1511
+ const DuetUpload = DuetUpload$1;
1512
+ const defineCustomElement = defineCustomElement$1;
1513
+
1514
+ export { DuetUpload, defineCustomElement };