@duetds/components 4.30.1 → 4.31.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 (312) hide show
  1. package/hydrate/index.js +230 -1038
  2. package/lib/cjs/duet-alert.cjs.entry.js +4 -2
  3. package/lib/cjs/duet-badge.cjs.entry.js +2 -2
  4. package/lib/cjs/duet-button_2.cjs.entry.js +4 -3
  5. package/lib/cjs/duet-caption_4.cjs.entry.js +7 -8
  6. package/lib/cjs/duet-card.cjs.entry.js +4 -4
  7. package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
  8. package/lib/cjs/duet-choice_2.cjs.entry.js +4 -3
  9. package/lib/cjs/duet-collapsible.cjs.entry.js +2 -2
  10. package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
  11. package/lib/cjs/duet-date-picker.cjs.entry.js +22 -12
  12. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
  13. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
  14. package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
  15. package/lib/cjs/duet-footer.cjs.entry.js +4 -4
  16. package/lib/cjs/duet-grid_2.cjs.entry.js +1 -1
  17. package/lib/cjs/duet-header_2.cjs.entry.js +25 -9
  18. package/lib/cjs/duet-hero.cjs.entry.js +6 -6
  19. package/lib/cjs/duet-icon.cjs.entry.js +3 -3
  20. package/lib/cjs/duet-input_2.cjs.entry.js +2 -2
  21. package/lib/cjs/duet-layout.cjs.entry.js +1 -1
  22. package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
  23. package/lib/cjs/duet-modal.cjs.entry.js +8 -7
  24. package/lib/cjs/duet-notification_2.cjs.entry.js +6 -5
  25. package/lib/cjs/duet-number-input.cjs.entry.js +36 -15
  26. package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
  27. package/lib/cjs/duet-range-slider.cjs.entry.js +1 -1
  28. package/lib/cjs/duet-select.cjs.entry.js +2 -2
  29. package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
  30. package/lib/cjs/duet-tab_2.cjs.entry.js +11 -5
  31. package/lib/cjs/duet-table.cjs.entry.js +1 -1
  32. package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
  33. package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
  34. package/lib/cjs/duet-tooltip.cjs.entry.js +21 -10
  35. package/lib/cjs/duet-tray.cjs.entry.js +20 -9
  36. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  37. package/lib/cjs/duet.cjs.js +2 -2
  38. package/lib/cjs/{focus-utils-7605778f.js → focus-utils-bd331feb.js} +1 -1
  39. package/lib/cjs/{index-0c949193.js → index-113c2add.js} +0 -3
  40. package/lib/cjs/{language-utils-70d6a9a4.js → language-utils-48b8860b.js} +23 -8
  41. package/lib/cjs/loader.cjs.js +2 -2
  42. package/lib/cjs/{string-utils-a6de43d8.js → string-utils-267e3dbb.js} +7 -0
  43. package/lib/collection/collection-manifest.json +0 -6
  44. package/lib/collection/components/duet-alert/duet-alert.js +10 -4
  45. package/lib/collection/components/duet-badge/duet-badge.css +1 -0
  46. package/lib/collection/components/duet-button/duet-button.js +7 -5
  47. package/lib/collection/components/duet-card/duet-card.css +10 -7
  48. package/lib/collection/components/duet-card/duet-card.js +3 -5
  49. package/lib/collection/components/duet-choice/duet-choice.js +5 -3
  50. package/lib/collection/components/duet-choice-group/duet-choice-group.css +1 -0
  51. package/lib/collection/components/duet-date-picker/duet-date-picker.css +1 -1
  52. package/lib/collection/components/duet-date-picker/duet-date-picker.js +73 -38
  53. package/lib/collection/components/duet-footer/duet-footer.js +7 -5
  54. package/lib/collection/components/duet-header/duet-header.js +46 -21
  55. package/lib/collection/components/duet-heading/duet-heading.css +1 -0
  56. package/lib/collection/components/duet-hero/duet-hero.js +14 -9
  57. package/lib/collection/components/duet-icon/icon-utils.js +1 -1
  58. package/lib/collection/components/duet-label/duet-label.css +2 -0
  59. package/lib/collection/components/duet-link/duet-link.js +10 -11
  60. package/lib/collection/components/duet-modal/duet-modal.js +16 -11
  61. package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.js +14 -9
  62. package/lib/collection/components/duet-number-input/duet-number-input.js +141 -17
  63. package/lib/collection/components/duet-tab-group/duet-tab-group.js +35 -4
  64. package/lib/collection/components/duet-tooltip/duet-tooltip.js +72 -10
  65. package/lib/collection/components/duet-tray/duet-tray.js +71 -9
  66. package/lib/collection/utils/fixture-utils.js +7 -5
  67. package/lib/collection/utils/language-utils.js +22 -8
  68. package/lib/collection/utils/string-utils.js +6 -0
  69. package/lib/custom-elements-bundle/index.d.ts +0 -6
  70. package/lib/custom-elements-bundle/index.js +224 -995
  71. package/lib/duet/duet.esm.js +1 -1
  72. package/lib/duet/duet.js +1 -1
  73. package/lib/duet/p-0058512b.js +4 -0
  74. package/lib/duet/p-0224db45.entry.js +4 -0
  75. package/lib/duet/{p-345ea4f2.system.entry.js → p-02ad46a0.system.entry.js} +1 -1
  76. package/lib/duet/{p-62806bb6.system.entry.js → p-07263910.system.entry.js} +1 -1
  77. package/lib/duet/{p-f82709ba.entry.js → p-1bfbc988.entry.js} +1 -1
  78. package/lib/duet/p-1cd7177f.entry.js +4 -0
  79. package/lib/duet/p-1cec5a70.system.entry.js +4 -0
  80. package/lib/duet/p-1e7222c2.entry.js +4 -0
  81. package/lib/duet/{p-c0b95b58.entry.js → p-202bbd70.entry.js} +1 -1
  82. package/lib/duet/{p-d1817efe.system.entry.js → p-22f56356.system.entry.js} +1 -1
  83. package/lib/duet/{p-f81d8534.entry.js → p-28b67b94.entry.js} +1 -1
  84. package/lib/duet/{p-b4374f0e.entry.js → p-33426ddc.entry.js} +1 -1
  85. package/lib/duet/p-33cf6ed1.entry.js +4 -0
  86. package/lib/duet/p-3d3f773d.system.entry.js +4 -0
  87. package/lib/duet/p-3e1ef509.system.entry.js +4 -0
  88. package/lib/duet/p-3f78a826.system.js +4 -0
  89. package/lib/duet/{p-2a1a9f9f.entry.js → p-44ffb960.entry.js} +1 -1
  90. package/lib/duet/{p-dee41056.system.entry.js → p-453955cc.system.entry.js} +1 -1
  91. package/lib/duet/{p-66dde4d2.entry.js → p-4670a654.entry.js} +1 -1
  92. package/lib/duet/p-47645ea8.system.entry.js +4 -0
  93. package/lib/duet/p-504dbf8f.system.entry.js +4 -0
  94. package/lib/duet/{p-62c294d6.system.entry.js → p-5230ee3c.system.entry.js} +1 -1
  95. package/lib/duet/{p-bbc229d8.system.entry.js → p-56e172f5.system.entry.js} +1 -1
  96. package/lib/duet/{p-de2be65b.system.js → p-57ea2576.system.js} +1 -1
  97. package/lib/duet/p-5aa0d34d.entry.js +4 -0
  98. package/lib/duet/p-5fc7e1f7.system.entry.js +4 -0
  99. package/lib/duet/{p-3dc9d15d.system.entry.js → p-605bc214.system.entry.js} +1 -1
  100. package/lib/duet/{p-4a7911fd.entry.js → p-60ab57d4.entry.js} +1 -1
  101. package/lib/duet/p-64109493.entry.js +4 -0
  102. package/lib/duet/{p-7e108b7e.entry.js → p-69a5dc6b.entry.js} +1 -1
  103. package/lib/duet/{p-8cfce39e.system.entry.js → p-6a230911.system.entry.js} +1 -1
  104. package/lib/duet/p-6a760b8a.entry.js +4 -0
  105. package/lib/duet/{p-c9303f9a.entry.js → p-6d2da245.entry.js} +1 -1
  106. package/lib/duet/{p-ceb75b35.system.entry.js → p-712e7dde.system.entry.js} +1 -1
  107. package/lib/duet/{p-f71f12ed.entry.js → p-746655ba.entry.js} +1 -1
  108. package/lib/duet/p-7b6db837.system.entry.js +4 -0
  109. package/lib/duet/p-7d080785.system.entry.js +4 -0
  110. package/lib/duet/{p-4095dba5.entry.js → p-82dc2e0b.entry.js} +1 -1
  111. package/lib/duet/p-8c8e82aa.system.js +4 -0
  112. package/lib/duet/{p-fc397e03.system.entry.js → p-8c980350.system.entry.js} +1 -1
  113. package/lib/duet/{p-1cfe38b1.system.entry.js → p-8cb47a70.system.entry.js} +1 -1
  114. package/lib/duet/{p-7ee52f58.entry.js → p-8f03c3eb.entry.js} +1 -1
  115. package/lib/duet/p-91fa68a5.js +4 -0
  116. package/lib/duet/{p-e26116e0.system.entry.js → p-92d38668.system.entry.js} +1 -1
  117. package/lib/duet/p-95626e7e.system.entry.js +4 -0
  118. package/lib/duet/p-96808a2e.system.entry.js +4 -0
  119. package/lib/duet/{p-8ffe1461.system.entry.js → p-96c103b2.system.entry.js} +1 -1
  120. package/lib/duet/p-986779fb.js +4 -0
  121. package/lib/duet/{p-35e45c19.system.js → p-9a945278.system.js} +1 -1
  122. package/lib/duet/{p-2d2c45f9.entry.js → p-9c94be45.entry.js} +1 -1
  123. package/lib/duet/p-9ce1baab.system.entry.js +4 -0
  124. package/lib/duet/p-9ff25646.entry.js +4 -0
  125. package/lib/duet/p-a1d12e94.system.entry.js +4 -0
  126. package/lib/duet/p-b03a46b6.entry.js +4 -0
  127. package/lib/duet/{p-a88df408.entry.js → p-b1b8e510.entry.js} +1 -1
  128. package/lib/duet/p-b694cbf5.system.js +4 -0
  129. package/lib/duet/p-b7e50cfa.entry.js +4 -0
  130. package/lib/duet/p-b82927b0.system.entry.js +4 -0
  131. package/lib/duet/{p-c3688975.entry.js → p-ba205dca.entry.js} +1 -1
  132. package/lib/duet/{p-f71e337e.system.entry.js → p-bcae23fc.system.entry.js} +1 -1
  133. package/lib/duet/{p-5c5bdb06.system.entry.js → p-be19c57b.system.entry.js} +1 -1
  134. package/lib/duet/{p-a321a98c.entry.js → p-c4737f88.entry.js} +1 -1
  135. package/lib/duet/p-c5beceed.js +4 -0
  136. package/lib/duet/{p-27d538f7.system.entry.js → p-c5f10483.system.entry.js} +1 -1
  137. package/lib/duet/{p-a6096b05.system.entry.js → p-d35fd913.system.entry.js} +1 -1
  138. package/lib/duet/p-d4b4bfa6.entry.js +4 -0
  139. package/lib/duet/p-d7623eb8.system.entry.js +4 -0
  140. package/lib/duet/{p-36007600.entry.js → p-dc85d2a4.entry.js} +1 -1
  141. package/lib/duet/p-de093c16.entry.js +4 -0
  142. package/lib/duet/p-de842863.entry.js +4 -0
  143. package/lib/duet/{p-59a07cf9.entry.js → p-e08b8909.entry.js} +1 -1
  144. package/lib/duet/p-e39471b6.entry.js +4 -0
  145. package/lib/duet/p-e834c8d5.system.entry.js +4 -0
  146. package/lib/duet/{p-ce1374a4.system.entry.js → p-ef45cfe9.system.entry.js} +1 -1
  147. package/lib/duet/{p-031c2cd8.system.entry.js → p-f0b1850a.system.entry.js} +1 -1
  148. package/lib/duet/p-f53c8019.entry.js +4 -0
  149. package/lib/duet/{p-4265de16.system.entry.js → p-f96c4093.system.entry.js} +1 -1
  150. package/lib/duet/p-fbd83d67.entry.js +4 -0
  151. package/lib/duet/{p-1c41525a.entry.js → p-fdecaf46.entry.js} +1 -1
  152. package/lib/esm/duet-alert.entry.js +4 -2
  153. package/lib/esm/duet-badge.entry.js +2 -2
  154. package/lib/esm/duet-button_2.entry.js +4 -3
  155. package/lib/esm/duet-caption_4.entry.js +7 -8
  156. package/lib/esm/duet-card.entry.js +4 -4
  157. package/lib/esm/duet-checkbox.entry.js +1 -1
  158. package/lib/esm/duet-choice_2.entry.js +4 -3
  159. package/lib/esm/duet-collapsible.entry.js +2 -2
  160. package/lib/esm/duet-cookie-consent.entry.js +1 -1
  161. package/lib/esm/duet-date-picker.entry.js +22 -12
  162. package/lib/esm/duet-divider_2.entry.js +1 -1
  163. package/lib/esm/duet-empty-state.entry.js +1 -1
  164. package/lib/esm/duet-fieldset.entry.js +1 -1
  165. package/lib/esm/duet-footer.entry.js +4 -4
  166. package/lib/esm/duet-grid_2.entry.js +1 -1
  167. package/lib/esm/duet-header_2.entry.js +25 -9
  168. package/lib/esm/duet-hero.entry.js +6 -6
  169. package/lib/esm/duet-icon.entry.js +3 -3
  170. package/lib/esm/duet-input_2.entry.js +2 -2
  171. package/lib/esm/duet-layout.entry.js +1 -1
  172. package/lib/esm/duet-list_2.entry.js +1 -1
  173. package/lib/esm/duet-modal.entry.js +8 -7
  174. package/lib/esm/duet-notification_2.entry.js +6 -5
  175. package/lib/esm/duet-number-input.entry.js +36 -15
  176. package/lib/esm/duet-radio_2.entry.js +1 -1
  177. package/lib/esm/duet-range-slider.entry.js +1 -1
  178. package/lib/esm/duet-select.entry.js +2 -2
  179. package/lib/esm/duet-step_2.entry.js +1 -1
  180. package/lib/esm/duet-tab_2.entry.js +11 -5
  181. package/lib/esm/duet-table.entry.js +1 -1
  182. package/lib/esm/duet-textarea.entry.js +1 -1
  183. package/lib/esm/duet-toggle.entry.js +1 -1
  184. package/lib/esm/duet-tooltip.entry.js +21 -10
  185. package/lib/esm/duet-tray.entry.js +20 -9
  186. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  187. package/lib/esm/duet.js +2 -2
  188. package/lib/esm/{focus-utils-0b12f0df.js → focus-utils-1995e5a9.js} +1 -1
  189. package/lib/esm/{index-f70ddc7f.js → index-6e246691.js} +0 -3
  190. package/lib/esm/{language-utils-ab9c3afc.js → language-utils-d5c38f65.js} +23 -8
  191. package/lib/esm/loader.js +2 -2
  192. package/lib/esm/{string-utils-69cf0d09.js → string-utils-2f1793b8.js} +7 -1
  193. package/lib/esm-es5/duet-alert.entry.js +1 -1
  194. package/lib/esm-es5/duet-badge.entry.js +1 -1
  195. package/lib/esm-es5/duet-button_2.entry.js +1 -1
  196. package/lib/esm-es5/duet-caption_4.entry.js +1 -1
  197. package/lib/esm-es5/duet-card.entry.js +1 -1
  198. package/lib/esm-es5/duet-checkbox.entry.js +1 -1
  199. package/lib/esm-es5/duet-choice_2.entry.js +1 -1
  200. package/lib/esm-es5/duet-collapsible.entry.js +1 -1
  201. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  202. package/lib/esm-es5/duet-date-picker.entry.js +1 -1
  203. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  204. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  205. package/lib/esm-es5/duet-fieldset.entry.js +1 -1
  206. package/lib/esm-es5/duet-footer.entry.js +1 -1
  207. package/lib/esm-es5/duet-grid_2.entry.js +1 -1
  208. package/lib/esm-es5/duet-header_2.entry.js +1 -1
  209. package/lib/esm-es5/duet-hero.entry.js +1 -1
  210. package/lib/esm-es5/duet-icon.entry.js +1 -1
  211. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  212. package/lib/esm-es5/duet-layout.entry.js +1 -1
  213. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  214. package/lib/esm-es5/duet-modal.entry.js +1 -1
  215. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  216. package/lib/esm-es5/duet-number-input.entry.js +2 -2
  217. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  218. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  219. package/lib/esm-es5/duet-select.entry.js +1 -1
  220. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  221. package/lib/esm-es5/duet-tab_2.entry.js +1 -1
  222. package/lib/esm-es5/duet-table.entry.js +1 -1
  223. package/lib/esm-es5/duet-textarea.entry.js +1 -1
  224. package/lib/esm-es5/duet-toggle.entry.js +1 -1
  225. package/lib/esm-es5/duet-tooltip.entry.js +1 -1
  226. package/lib/esm-es5/duet-tray.entry.js +1 -1
  227. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  228. package/lib/esm-es5/duet.js +1 -1
  229. package/lib/esm-es5/focus-utils-1995e5a9.js +4 -0
  230. package/lib/esm-es5/{index-f70ddc7f.js → index-6e246691.js} +1 -1
  231. package/lib/esm-es5/language-utils-d5c38f65.js +4 -0
  232. package/lib/esm-es5/loader.js +1 -1
  233. package/lib/esm-es5/{string-utils-69cf0d09.js → string-utils-2f1793b8.js} +1 -1
  234. package/lib/html.html-data.json +4489 -0
  235. package/lib/types/components/duet-alert/duet-alert.d.ts +2 -1
  236. package/lib/types/components/duet-button/duet-button.d.ts +1 -1
  237. package/lib/types/components/duet-choice/duet-choice.d.ts +1 -1
  238. package/lib/types/components/duet-date-picker/duet-date-picker.d.ts +13 -7
  239. package/lib/types/components/duet-footer/duet-footer.d.ts +1 -1
  240. package/lib/types/components/duet-header/duet-header.d.ts +21 -5
  241. package/lib/types/components/duet-hero/duet-hero.d.ts +3 -3
  242. package/lib/types/components/duet-link/duet-link.d.ts +2 -3
  243. package/lib/types/components/duet-modal/duet-modal.d.ts +3 -3
  244. package/lib/types/components/duet-notification-drawer/duet-notification-drawer.d.ts +3 -3
  245. package/lib/types/components/duet-number-input/duet-number-input.d.ts +21 -0
  246. package/lib/types/components/duet-tab-group/duet-tab-group.d.ts +6 -0
  247. package/lib/types/components/duet-tooltip/duet-tooltip.d.ts +11 -0
  248. package/lib/types/components/duet-tray/duet-tray.d.ts +11 -0
  249. package/lib/types/components.d.ts +146 -384
  250. package/lib/types/utils/language-utils.d.ts +3 -2
  251. package/lib/types/utils/string-utils.d.ts +1 -0
  252. package/package.json +18 -14
  253. package/lib/cjs/duet-upload.cjs.entry.js +0 -866
  254. package/lib/collection/components/duet-upload/duet-upload-file-list.js +0 -49
  255. package/lib/collection/components/duet-upload/duet-upload-validators.js +0 -93
  256. package/lib/collection/components/duet-upload/duet-upload.css +0 -133
  257. package/lib/collection/components/duet-upload/duet-upload.js +0 -1440
  258. package/lib/collection/components/duet-upload/errorcodes.utils.js +0 -20
  259. package/lib/collection/components/duet-upload/mock.helpers.js +0 -91
  260. package/lib/collection/components/duet-upload/upload.helpers.js +0 -13
  261. package/lib/collection/components/duet-upload/xhr.helpers.js +0 -34
  262. package/lib/duet/p-0733c303.system.entry.js +0 -4
  263. package/lib/duet/p-095060cc.js +0 -4
  264. package/lib/duet/p-156864a1.system.entry.js +0 -4
  265. package/lib/duet/p-1911dfe7.system.entry.js +0 -4
  266. package/lib/duet/p-2834a302.entry.js +0 -4
  267. package/lib/duet/p-28a3d38f.system.entry.js +0 -4
  268. package/lib/duet/p-2a4d7c5b.system.entry.js +0 -4
  269. package/lib/duet/p-4289b543.entry.js +0 -4
  270. package/lib/duet/p-46a3ae43.system.js +0 -4
  271. package/lib/duet/p-4a38cf9d.entry.js +0 -4
  272. package/lib/duet/p-4be8e814.entry.js +0 -4
  273. package/lib/duet/p-591b2137.entry.js +0 -4
  274. package/lib/duet/p-5f70e318.entry.js +0 -4
  275. package/lib/duet/p-6c2729da.js +0 -4
  276. package/lib/duet/p-6f107847.system.entry.js +0 -4
  277. package/lib/duet/p-77a5fe4c.system.js +0 -4
  278. package/lib/duet/p-7809e78b.system.entry.js +0 -4
  279. package/lib/duet/p-7a36d76f.system.entry.js +0 -4
  280. package/lib/duet/p-884693f1.entry.js +0 -4
  281. package/lib/duet/p-8977b722.entry.js +0 -4
  282. package/lib/duet/p-89db3b94.entry.js +0 -4
  283. package/lib/duet/p-9381c2d4.entry.js +0 -4
  284. package/lib/duet/p-9a450c9a.entry.js +0 -4
  285. package/lib/duet/p-9bbfe606.system.entry.js +0 -4
  286. package/lib/duet/p-a0a066cb.system.entry.js +0 -4
  287. package/lib/duet/p-a89d5d7c.entry.js +0 -4
  288. package/lib/duet/p-b07055fd.system.entry.js +0 -4
  289. package/lib/duet/p-b456d684.system.entry.js +0 -4
  290. package/lib/duet/p-bd18c93f.js +0 -4
  291. package/lib/duet/p-bddb1c15.system.entry.js +0 -4
  292. package/lib/duet/p-c4d183e6.entry.js +0 -4
  293. package/lib/duet/p-cd4e8ccf.js +0 -4
  294. package/lib/duet/p-cf243bcb.system.entry.js +0 -4
  295. package/lib/duet/p-d37c8a05.system.js +0 -4
  296. package/lib/duet/p-d989af11.entry.js +0 -4
  297. package/lib/duet/p-e6128d82.system.entry.js +0 -4
  298. package/lib/duet/p-e86cdc17.entry.js +0 -4
  299. package/lib/duet/p-eadb29c7.entry.js +0 -4
  300. package/lib/duet/p-f30b14d6.system.entry.js +0 -4
  301. package/lib/duet/p-f79f8da1.entry.js +0 -4
  302. package/lib/esm/duet-upload.entry.js +0 -862
  303. package/lib/esm-es5/duet-upload.entry.js +0 -4
  304. package/lib/esm-es5/focus-utils-0b12f0df.js +0 -4
  305. package/lib/esm-es5/language-utils-ab9c3afc.js +0 -4
  306. package/lib/types/components/duet-upload/duet-upload-file-list.d.ts +0 -9
  307. package/lib/types/components/duet-upload/duet-upload-validators.d.ts +0 -12
  308. package/lib/types/components/duet-upload/duet-upload.d.ts +0 -311
  309. package/lib/types/components/duet-upload/errorcodes.utils.d.ts +0 -7
  310. package/lib/types/components/duet-upload/mock.helpers.d.ts +0 -2
  311. package/lib/types/components/duet-upload/upload.helpers.d.ts +0 -1
  312. package/lib/types/components/duet-upload/xhr.helpers.d.ts +0 -12
@@ -1,4 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,a,i){function r(e){return e instanceof a?e:new a((function(t){t(e)}))}return new(a||(a=Promise))((function(a,s){function n(e){try{o(i.next(e))}catch(t){s(t)}}function l(e){try{o(i["throw"](e))}catch(t){s(t)}}function o(e){e.done?a(e.value):r(e.value).then(n,l)}o((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var a={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,n;return n={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function l(e){return function(t){return o([e,t])}}function o(n){if(i)throw new TypeError("Generator is already executing.");while(a)try{if(i=1,r&&(s=n[0]&2?r["return"]:n[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;if(r=0,s)n=[n[0]&2,s.value];switch(n[0]){case 0:case 1:s=n;break;case 4:a.label++;return{value:n[1],done:false};case 5:a.label++;r=n[1];n=[0];continue;case 7:n=a.ops.pop();a.trys.pop();continue;default:if(!(s=a.trys,s=s.length>0&&s[s.length-1])&&(n[0]===6||n[0]===2)){a=0;continue}if(n[0]===3&&(!s||n[1]>s[0]&&n[1]<s[3])){a.label=n[1];break}if(n[0]===6&&a.label<s[1]){a.label=s[1];s=n;break}if(s&&a.label<s[2]){a.label=s[2];a.ops.push(n);break}if(s[2])a.ops.pop();a.trys.pop();continue}n=t.call(e,a)}catch(l){n=[6,l];r=0}finally{i=s=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};
2
- /*!
3
- * Built with Duet Design System
4
- */import{h,r as registerInstance,c as createEvent,H as Host,g as getElement}from"./index-f70ddc7f.js";import{c as createID}from"./create-id-981107da.js";import{g as getLocaleString}from"./language-utils-ab9c3afc.js";import{i as inheritGlobalTheme}from"./themeable-component-572685dd.js";var formatBytes=function(e,t){if(t===void 0){t=2}if(e===0){return"0 Bytes"}var a=1024;var i=t<0?0:t;var r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];var s=Math.floor(Math.log(e)/Math.log(a));return parseFloat((e/Math.pow(a,s)).toFixed(i))+" "+r[s]};var DuetUploadFileList=function(e){var t=e.data,a=e.onDelete,i=e.onCancel,r=e.getError;if(t.invalid.length===0&&t.valid.length===0){return}return h("ol",{class:"duet-upload-filelist"},t.valid.length!==0&&h("li",null,h("duet-visually-hidden",null,"Files"),h("ul",null,t.valid.length!==0&&t.valid.map((function(e){return h("li",{class:"duet-upload-file"},h("div",{class:"duet-upload-file-container"},h("div",{class:"duet-upload-file-link"},e.url?h("duet-button",{variation:"plain",icon:"messaging-attachment",url:e.url},e.item.name," (",formatBytes(e.item.size),")"):e.item.name+" ("+formatBytes(e.item.size)+")"),h("ul",{class:"duet-upload-file-actions",role:"menubar","aria-label":"file actions"},e.progress<100&&h("li",{role:"none"},h("duet-button",{role:"menuitem",variation:"plain",icon:"messaging-declined","icon-only":true,"icon-size":"large",margin:"none",onClick:function(t){return i(e.item.name,t)}})),e.progress===100&&h("li",{role:"none"},h("duet-button",{role:"menuitem",variation:"destructive",icon:"action-delete","icon-only":true,"icon-size":"large",margin:"none",onClick:function(t){return a(e.item.name,t)}})))),e.progress<100&&h("div",{class:"duet-upload-file-progress"},h("progress",{value:e.progress,max:"100"},h("div",{class:"progress-bar"},h("span",{style:{width:e.progress+"%;"}},"Progress: ",e.progress,"%")))))})))),t.invalid.length!==0&&h("li",null,h("duet-visually-hidden",null,"Files with Errors"),h("ul",null,t.invalid.map((function(e){return h("li",{class:"duet-upload-file duet-upload-file-errors"},h("div",{class:"duet-upload-file-container"},h("div",{class:"duet-upload-file-link duet-upload-file-link-error"},h("div",null,e.item.name," (",formatBytes(e.item.size),")"),h("div",{"data-error-type":e.error.type,"data-error-message":e.error.system_message},r(e.error.type))),h("ul",{class:"duet-upload-file-actions",role:"menubar","aria-label":"file actions"},h("li",{role:"none"},h("duet-button",{role:"menuitem",variation:"destructive",icon:"action-delete","icon-only":true,"icon-size":"large",margin:"none",onClick:function(t){return a(e.item.name,t)}})))))})))))};var errorcodes=[{type:"default",system_message:"unknown error",message:{fi:"",sv:"",en:"An unknown error occured, please try again"}},{type:"400",system_message:"Bad Request: The server could not understand the request due to invalid syntax.",message:{fi:"",sv:"",en:"The server rejected your file"}},{type:"401",system_message:"Not Authenticated: The client must authenticate itself to get the requested response..",message:{fi:"",sv:"",en:"You need to be logged in to upload files"}},{type:"403",system_message:"No Access: The client does not have access rights to the content;",message:{fi:"",sv:"",en:"You do not have the correct access rights to upload files"}},{type:"413",system_message:"Payload too large",message:{fi:"",sv:"",en:"The file was to large for the server to handle"}},{type:"415",system_message:"Unsupported media type",message:{fi:"",sv:"",en:"The server rejected the file because it had the wrong type"}},{type:"429",system_message:"Too many request from same address",message:{fi:"",sv:"",en:"The server has received to many request from you, please try again later"}},{type:"500",system_message:"Internal Server Error",message:{fi:"",sv:"",en:"The server reported an unknown error and the upload failed"}},{type:"duet-upload-100",system_message:"File extension not allowed",message:{fi:"",sv:"",en:"You cannot upload files with that extension"}},{type:"duet-upload-001",system_message:"File transfer failed",message:{fi:"",sv:"",en:"Your connection to the server was interrupted, try again"}},{type:"duet-upload-101",system_message:"File mimetype not allowed",message:{fi:"",sv:"",en:"You cannot upload files of that type"}},{type:"duet-upload-201",system_message:"File is too large",message:{fi:"",sv:"",en:"The file is larger than permitted"}},{type:"duet-upload-202",system_message:"The combined size of all files is too large",message:{fi:"",sv:"",en:"You have reached the maximum combined filesize"}},{type:"duet-upload-301",system_message:"The maximum file limit has been reached",message:{fi:"Liitteiden maksimimäärä saavutettu.",sv:"",en:"Maximum number of attachments reached."}}];var getError=function(e){var t={type:undefined,system_message:undefined,message:undefined};t=errorcodes.filter((function(t){return t.type===e}))[0];if(!t){t=errorcodes.filter((function(e){return e.type==="default"}))[0]}return t};var validateFileExtension=function(e,t){if(!t){return true}var a=e.split(".");var i=t.split(",");var r=a[a.length-1];return i.includes(r)};var validateFileMime=function(e,t){if(!t||!e){return true}var a=t.split(",");var i=false;a.forEach((function(t){var a=t.split("/");var r=e.split("/");if(a[0]===r[0]&&(a[1]===r[1]||a[1]==="*")){i=true}}));return i};var validateFileSize=function(e,t){if(!t||!e){return true}return t>=e};var validateFile=function(e,t){var a=t.allowedMimetypes,i=t.allowedExtensions,r=t.maxBytes;var s=false;var n=getError("default");if(e){var l=e.name,o=e.type,u=e.size;var d=validateFileMime(o,a);var f=validateFileExtension(l,i);var p=validateFileSize(u,r);if(!d){n=getError("duet-upload-101")}if(!f){n=getError("duet-upload-100")}if(!p){n=getError("duet-upload-201")}s=d&&f&&p}else{s=false}return{valid:s,errorMessage:s?undefined:getLocaleString(n.message),errorSystem:s?undefined:n.system_message,errorType:s?undefined:n.type}};var validateTotalSizeIsAboveMax=function(e,t){var a=0;if(t){e.forEach((function(e){if(e.valid&&e.size){a+=e.size}}));if(a<t){return true}}return false};var validateTotalAmountIsAboveMax=function(e,t){var a=0;if(t){e.forEach((function(e){if(e.valid){a++}}));if(a>t){return true}}return false};var makeXhrRequest=function(e,t,a,i,r){var s=Object.assign({type:"POST",argument:null,headers:null},t),n=s.type,l=s.xhr,o=s.uri,u=s.argument,d=s.headers;l.open(n,""+o+(u||""),true);var f=e.data,p=e.name;if(d){Object.keys(d).forEach((function(e){l.setRequestHeader(e,d[e])}))}if(n==="POST"){l.onreadystatechange=function(){if(l.readyState===XMLHttpRequest.DONE&&l.status>=200&&l.status<300){i(l,p,l.status)}if(l.readyState===XMLHttpRequest.DONE&&l.status>=300&&l.status<999){a(l,p,l.status)}};r(p)}l.send(f);return l};var 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}:host li{list-style:none}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload li{list-style:none}.duet-upload-file-errors{padding:20px 0;color:#de2362}.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;background-color:#f3f9fc}.duet-upload-file{display:flex;flex-flow:column;justify-content:center;min-height:50px;border-bottom:1px solid #e1e3e6}.duet-upload-file:first-of-type:not(.duet-upload-file-errors){border-top:1px solid #e1e3e6}.duet-upload-file-container{display:flex;place-items:center;width:100%}.duet-upload-file-link{display:flex;flex-grow:2;place-items:center}.duet-upload-file-link-error{flex-direction:column;place-items:flex-start}.duet-upload-file-link duet-button{position:relative;top:6px}.duet-upload-file-actions{display:flex;transform:scale(0.8)}.duet-upload-file-progress{}.duet-upload-file-progress .progress-bar{position:relative;display:block;width:100%;height:15px;background-color:#f3f9fc;border-radius:0;box-shadow:none}.duet-upload-file-progress .progress-bar>span{display:block;text-indent:-9999px;background-color:#0077b3;border-radius:0}.duet-upload-file-progress progress[value]{display:flex;width:100%;height:15px;color:#0077b3;border:0 none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.duet-upload-file-progress progress[value]::-webkit-progress-bar{background-color:#f3f9fc;border-radius:0}.duet-upload-file-progress progress[value]::-webkit-progress-value{background-color:#0077b3;background-size:35px 20px, 100% 100%, 100% 100%;border-radius:0;-webkit-animation:animate-stripes 5s linear infinite;animation:animate-stripes 5s linear infinite}.duet-upload-file-progress progress[value] ::-moz-progress-bar{background-color:#f3f9fc}";var DuetUpload=function(){function e(e){var t=this;registerInstance(this,e);this.duetChange=createEvent(this,"duetChange",3);this.duetBlur=createEvent(this,"duetBlur",7);this.duetFocus=createEvent(this,"duetFocus",7);this.duetDone=createEvent(this,"duetDone",3);this.duetState=createEvent(this,"duetState",3);this.duetDelete=createEvent(this,"duetDelete",3);this.duetCancel=createEvent(this,"duetCancel",3);this.duetProgress=createEvent(this,"duetProgress",3);this.duetUpload=createEvent(this,"duetUpload",3);this.buttonId=createID("DuetButton");this.labelId=createID("DuetLabel");this.uploadId=createID("DuetUpload");this.filesInProgress=new Map;this.fileMaxReached=false;this.bytesMaxReached=false;this.tick=Date.now();this.external=false;this.buttonLabelDefaults={fi:"Lisää liite",sv:"Lägg till en bilaga",en:"Add an attachment"};this.buttonLabel=getLocaleString(this.buttonLabelDefaults);this.accessibleButtonLabel=undefined;this.theme="";this.disabled=false;this.margin="auto";this.required=false;this.files=new Map;this.valid=!this.required;this.labelDefaults={fi:"Lisää liite",sv:"Lägg till en bilaga",en:"Add attachments"};this.label=getLocaleString(this.labelDefaults);this.descriptionDefaults={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.",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.",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."};this.description=getLocaleString(this.descriptionDefaults);this.fileListEmptyDefaults={fi:"Ei vielä lisättyjä tiedostoja.",sv:"Inga filer har lagts till ännu.",en:"No files added yet."};this.fileListEmpty=getLocaleString(this.fileListEmptyDefaults);this.error="";this.labelHidden=false;this.capture=undefined;this.maxBytes=2e8;this.maxBytesTotal=undefined;this.maxFiles=99;this.allowedExtensions="all";this.allowedMimetypes="*";this.multiple=true;this.limitSelection=false;this.kick=function(){return t.tick=Date.now()};this.genHashName=function(){return Date.now().toString(36)+Math.random()};this.updateValueInMap=function(e,a,i,r){if(r===void 0){r=true}var s=t.files.get(e);s[a]=i;t.files.set(e,s);if(r){t.kick()}};this.updateProgress=function(e,a){if(e.lengthComputable){var i=e.loaded/e.total*100;t.updateValueInMap(a,"progress",i);t.onProgress(a,i,e)}else{console.log("cant read progress")}};this.trackProgress=function(e,a){if(a===void 0){a=false}if(a){t.filesInProgress.delete(e)}else{t.filesInProgress.set(e,"inprogress")}if(t.filesInProgress.size===0){t.onDone()}};this.getFilesAsArray=function(){var e=[];var a=[];t.files.forEach((function(t){if(t.valid&&!t.deleted){e.push(t)}else if(!t.valid&&!t.deleted){a.push(t)}}));return{valid:e,invalid:a}};this.resetFormFields=function(){t.nativeInput.value=""};this.getI18nError=function(e){var t=getError(e);var a=getLocaleString(t.message);if(a===""||!a){return t.system_message}else{return a}};this.transferComplete=function(e){t.updateValueInMap(e,"progress",100,false);t.trackProgress(e,true)};this.transferDone=function(e,a,i){t.updateValueInMap(a,"status",i,false);try{var r=JSON.parse(e.response);t.updateValueInMap(a,"url",r.url)}catch(s){t.updateValueInMap(a,"url",null);console.error("Server did not respond with expected response {url: string}")}return};this.transferDoneWithFailure=function(e,a,i){try{var r=JSON.parse(e.response).error;t.updateValueInMap(a,"error",{message:r.message,type:r.type})}catch(s){console.error("Server did not respond with expected response error:{message: string, type: int}");t.updateValueInMap(a,"error",{type:i})}};this.transferFailed=function(e){t.updateValueInMap(e,"error",getError("duet-upload-001"))};this.transferCanceled=function(e){t.files.delete(e);t.validateTotals(e);t.kick()};this.validateTotals=function(e){var a=validateTotalSizeIsAboveMax(t.files,t.maxBytesTotal);var i=validateTotalAmountIsAboveMax(t.files,t.maxFiles);if(a&&e){t.updateValueInMap(e,"error",getError("duet-upload-202"),false)}if(i&&e){t.updateValueInMap(e,"error",getError("duet-upload-301"),false)}t.bytesMaxReached=a;t.fileMaxReached=i;return{bytesMaxReached:a,fileMaxReached:i}};this.onDelete=function(e,a){var i=t.files.get(e);t.files.delete(e);t.validateTotals();t.kick();if(!t.external){t.makeXHRDeleteRequest(i)}t.resetFormFields();t.duetDelete.emit({originalEvent:a,data:{deletion:i},component:"duet-upload"})};this.onCancel=function(e,a){var i=t.files.get(e);t.files.delete(e);if(!t.external){var r=i.xhr;r.abort()}else{t.kick()}t.resetFormFields();t.duetCancel.emit({originalEvent:a,data:{cancelled:i},component:"duet-upload"})};this.onUpload=function(e){t.duetUpload.emit({originalEvent:e,component:"duet-upload"})};this.onBlur=function(e){t.duetBlur.emit({originalEvent:e,component:"duet-upload"})};this.onProgress=function(e,a,i){t.duetChange.emit({originalEvent:i,data:{key:e,percentComplete:a},component:"duet-upload"})};this.onFocus=function(e){t.duetFocus.emit({originalEvent:e,component:"duet-upload"})};this.onDone=function(){t.duetDone.emit({component:"duet-upload",data:{files:t.files}})};this.startUpload=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.setFocus()];case 1:t.sent();this.nativeInput.click();this.onUpload(e);e.stopPropagation();e.preventDefault();return[2]}}))}))}}e.prototype.watchValidHandler=function(e,t){if(e!==t){this.kick()}};e.prototype.componentWillLoad=function(){inheritGlobalTheme(this)};e.prototype.componentWillRender=function(){var e=this.getFilesAsArray(),t=e.invalid,a=e.valid;var i=this.valid;this.valid=t.length===0&&a.length!==0;if(this.valid!==i){this.duetState.emit({originalEvent:undefined,data:{valid:this.valid,from:"componentWillRender"},component:"duet-upload"})}};e.prototype.makeXHRPostRequest=function(e){var t=this;var a=new XMLHttpRequest;var i=e.get("name");a.upload.addEventListener("progress",(function(e){t.updateProgress(e,i)}));a.upload.addEventListener("load",(function(){t.transferComplete(i)}));a.upload.addEventListener("error",(function(){t.transferFailed(i)}));a.upload.addEventListener("abort",(function(){t.transferCanceled(i)}));return makeXhrRequest({data:e,name:i},{type:"POST",uri:this.uri,xhr:a,argument:null,headers:null},this.transferDoneWithFailure,this.transferDone,this.trackProgress)};e.prototype.makeXHRDeleteRequest=function(e){var t=e.uid,a=e.item;var i=new XMLHttpRequest;return makeXhrRequest({data:null,name:name},{type:"DELETE",xhr:i,uri:this.uri,arguments:"?key="+t+"&name="+a.name,headers:{"x-fileuid":t,"x-filename":a.name}},this.transferDoneWithFailure,this.transferDone,this.trackProgress)};e.prototype.onChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,a,i,r,s,n,l,o,u,d,f,p,c,h,m,g,v;return __generator(this,(function(y){switch(y.label){case 0:a=Array.from((t=this.nativeInput)===null||t===void 0?void 0:t.files);if(!a)return[3,7];i=0,r=a;y.label=1;case 1:if(!(i<r.length))return[3,7];s=r[i];n=validateFile(s,{maxBytes:this.maxBytes,allowedExtensions:this.allowedExtensions,allowedMimetypes:this.allowedMimetypes}),l=n.valid,o=n.errorMessage,u=n.errorType,d=n.errorSystem;f=this.genHashName();p={uid:f,item:s,size:s.size,valid:l,error:{type:l?undefined:u,message:l?undefined:o,system_message:l?undefined:d},progress:0,deleted:false,xhr:false,url:false};this.files.set(s.name,p);c=this.validateTotals(s.name),h=c.bytesMaxReached,m=c.fileMaxReached;if(!h)return[3,2];this.updateValueInMap(s.name,"valid",false,false);return[3,5];case 2:if(!m)return[3,3];this.updateValueInMap(s.name,"valid",false,false);return[3,5];case 3:if(!(l&&!this.external))return[3,5];g=new FormData;g.append("file",s);g.append("uid",f);g.append("name",s.name);g.append("metadata",JSON.stringify({uid:f,url:this.uri,size:s.size}));v=p;return[4,this.makeXHRPostRequest(g)];case 4:v.xhr=y.sent();y.label=5;case 5:this.kick();y.label=6;case 6:i++;return[3,1];case 7:this.resetFormFields();this.duetChange.emit({originalEvent:e,data:{files:this.files},component:"duet-upload"});return[2]}}))}))};e.prototype.setFocus=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.nativeInput){this.nativeInput.focus(e)}return[2]}))}))};e.prototype.getFiles=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.files||this.files.size===0){return[2,false]}return[2,this.getFilesAsArray()]}))}))};e.prototype.render=function(){var e=this;var t=this.identifier||this.uploadId;var a=this.description.replace(/{maxfiles}/g,this.maxFiles.toString());a=a.replace(/{maxbytes}/g,Math.floor(this.maxBytes/1024/1024)+" MB");a=a.replace(/{filetypes}/g,this.allowedExtensions.split(",").join(", "));return h(Host,{class:{"duet-m-0":this.margin==="none"}},h("duet-fieldset",{label:this.label,caption:a},h("slot",{name:"header"}),h("duet-label",{theme:this.theme==="turva"?"turva":"default",size:"small",class:{"duet-upload-filelist-empty":!this.files.size,"duet-upload-filelist":true,"duet-upload-filelist-filled":this.files.size},id:this.labelId,for:t},!this.files.size&&this.fileListEmpty),!!this.files.size&&h("slot",{name:"fileheader"}),h(DuetUploadFileList,{data:this.getFilesAsArray(),onDelete:this.onDelete,onCancel:this.onCancel,getError:this.getI18nError},h("li",null,"testing something")),!!this.files.size&&h("slot",{name:"filefooter"}),h("duet-spacer",{size:"large"}),h("duet-button",{id:this.buttonId,onClick:this.startUpload,"accessible-controls":t,disabled:this.fileMaxReached,"accessible-label":this.accessibleButtonLabel,"accessible-owns":t,size:"small",variation:"secondary",fixed:true,icon:"action-add-circle"},this.buttonLabel),h("duet-spacer",{size:"medium"}),(this.fileMaxReached||this.bytesMaxReached)&&h("duet-alert",null,this.fileMaxReached&&this.getI18nError("duet-upload-301"),this.bytesMaxReached&&this.getI18nError("duet-upload-202")),h("duet-spacer",{size:"medium"}),h("duet-visually-hidden",null,h("input",{ref:function(t){e.nativeInput=t},accept:this.limitSelection?undefined:this.allowedMimetypes+","+this.allowedExtensions,onBlur:this.onBlur,onFocus:this.onFocus,onChange:function(t){return e.onChange(t)},type:"file",class:{"duet-upload":true},disabled:this.disabled,"aria-hidden":"true",required:this.required,name:this.name,id:this.identifier,multiple:this.multiple,capture:"user"}))))};Object.defineProperty(e.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{valid:["watchValidHandler"]}},enumerable:false,configurable:true});return e}();DuetUpload.style=duetUploadCss;export{DuetUpload as duet_upload};
@@ -1,4 +0,0 @@
1
- /*!
2
- * Built with Duet Design System
3
- */
4
- import{h}from"./index-f70ddc7f.js";var focusElement=function(u){if("setFocus"in u){u.setFocus()}else{u.focus()}};var FocusGuard=function(u){var o=u.moveFocusTo;return h("div",{class:"duet-focus-guard","aria-hidden":"true",tabIndex:0,onFocus:function(){return focusElement(o)}})};export{FocusGuard as F,focusElement as f};
@@ -1,4 +0,0 @@
1
- /*!
2
- * Built with Duet Design System
3
- */
4
- var localeLookUpTable={fi:"fi-FI",en:"en-GB",us:"en-US",sv:"sv-SE"};var localeMonetarySignifierLookUpTable={fi:"€",en:"£",us:"$",sv:"€"};var defLanguageArray=["fi","en","sv"];var defaultLanguage="fi";var currentLanguage=document.documentElement.lang?document.documentElement.lang.toLowerCase():defaultLanguage;var isOfTypeLanguage=function(e){return defLanguageArray.includes(e)};var checkForLanguage=function(e){if(e===void 0){e=currentLanguage}if(isOfTypeLanguage(e)){return e}else{return defaultLanguage}};var getLanguage=function(e){if(e===void 0){e=currentLanguage}return checkForLanguage(e)};var getLocale=function(e){var a={locale:localeLookUpTable[e],money:localeMonetarySignifierLookUpTable[e]};if(a.locale&&a.money){return a}throw new Error('Locale for "'+e+'" not found')};var getLocaleString=function(e,a){if(a){return e[checkForLanguage(a)]}else{return e[getLanguage()]}};export{getLanguage as a,getLocale as b,getLocaleString as g};
@@ -1,9 +0,0 @@
1
- import { FunctionalComponent } from "../../stencil-public-runtime";
2
- interface FileListProps {
3
- data: Record<string, any>;
4
- onDelete: (string: any, EventEmitter: any) => void;
5
- onCancel: any;
6
- getError: any;
7
- }
8
- export declare const DuetUploadFileList: FunctionalComponent<FileListProps>;
9
- export {};
@@ -1,12 +0,0 @@
1
- import { StringMap } from "./duet-upload";
2
- export declare const validateFileExtension: (name: string, allowedExtensions: string) => boolean;
3
- export declare const validateFileMime: (type: any, allowedMimetypes: string) => boolean;
4
- export declare const validateFileSize: (size: any, maxBytes: any) => boolean;
5
- export declare const validateFile: (item: any, validators: Record<string, any>) => {
6
- valid: boolean;
7
- errorMessage: any;
8
- errorSystem: string;
9
- errorType: string;
10
- };
11
- export declare const validateTotalSizeIsAboveMax: (filelist: StringMap, maxTotalBytes: number) => boolean;
12
- export declare const validateTotalAmountIsAboveMax: (filelist: StringMap, maxFiles: number) => boolean;
@@ -1,311 +0,0 @@
1
- import { EventEmitter } from "../../stencil-public-runtime";
2
- import { DuetMargin, DuetTheme } from "../../common-types";
3
- import { FormComponent } from "../../utils/form-components";
4
- import { DuetLangObject } from "../../utils/language-utils";
5
- import { ThemeableComponent } from "../../utils/themeable-component";
6
- import { DuetUploadErrorCode } from "./errorcodes.utils";
7
- import { DuetXhrRequest } from "./xhr.helpers";
8
- export declare type DuetUploadEvent = {
9
- originalEvent?: Event;
10
- data?: Record<string, any>;
11
- component: "duet-upload";
12
- };
13
- export declare type DuetFileListItem = {
14
- uid: string;
15
- item: File | null;
16
- size: number;
17
- error: DuetUploadErrorCode;
18
- progress: number;
19
- deleted: boolean;
20
- valid: boolean;
21
- xhr: DuetXhrRequest | false;
22
- url: string | false;
23
- };
24
- export interface StringMap {
25
- [key: string]: any;
26
- }
27
- /**
28
- * @slot header - named slot - to place content after description / caption
29
- * @slot fileheader - named slot - to place content above filelist (only displayed when filelist contains items)
30
- * @slot filefooter - named slot - to place content below filelist (only displayed when filelist contains items)
31
- */
32
- export declare class DuetUpload implements ThemeableComponent, FormComponent {
33
- /**
34
- * Own Properties
35
- */
36
- private buttonId;
37
- private labelId;
38
- private uploadId;
39
- private filesInProgress;
40
- private fileMaxReached;
41
- private bytesMaxReached;
42
- private nativeInput?;
43
- /**
44
- * Reference to host HTML element.
45
- */
46
- element: HTMLElement;
47
- /**
48
- * State() variables
49
- */
50
- tick: number;
51
- /**
52
- * Indicates the id of a related component’s visually focused element.
53
- */
54
- accessibleActiveDescendant: string;
55
- /**
56
- * Indicates the id of a component that describes the upload component.
57
- */
58
- accessibleDescribedBy: string;
59
- /**
60
- * Use this prop to add an aria-controls attribute. Use the attribute to
61
- * indicate the id of a component controlled by this component.
62
- */
63
- accessibleControls: string;
64
- /**
65
- * Indicates the id of a component owned by the input.
66
- */
67
- accessibleOwns: string;
68
- /**
69
- * If external is set to true, the upload component will not actually upload the files, but only keep states
70
- * it will be up to you to handle the upload and return progress information to the upload-component
71
- */
72
- external: boolean;
73
- /**
74
- * Endpoint URI that is capable of receiving the files
75
- */
76
- uri: string;
77
- /**
78
- * Caption (underneath label) that can be set as a way of adding extra information
79
- */
80
- caption: string;
81
- /**
82
- * Property to change descriptionDefaults defaults on the component.
83
- * normally you would handle these strings on an application level and override @label when needed
84
- */
85
- buttonLabelDefaults: DuetLangObject;
86
- /**
87
- * Label of button
88
- * @default { fi: "Lisää liite", sv: "Lägg till en bilaga", en: "Add an attachment" }
89
- */
90
- buttonLabel: string;
91
- /**
92
- * accessible Label of button
93
- */
94
- accessibleButtonLabel: string;
95
- /**
96
- * Theme of the input.
97
- */
98
- theme: DuetTheme;
99
- /**
100
- * Makes the input component disabled. This prevents users from being able to
101
- * interact with the upload component, and conveys its inactive state to assistive technologies.
102
- */
103
- disabled: boolean;
104
- /**
105
- * Adds a unique identifier for the upload component.
106
- */
107
- identifier: string;
108
- /**
109
- * Controls the margin of the component.
110
- */
111
- margin: DuetMargin;
112
- /**
113
- * Set whether the input is required or not. Please note that this is necessary for
114
- * accessible inputs when the user is required to fill them. When using this property
115
- * you need to also set “novalidate” attribute to your form element to prevent
116
- * browser from displaying its own validation errors.
117
- */
118
- required: boolean;
119
- /**
120
- * Map of string that contain list of uploaded files.
121
- */
122
- files: StringMap;
123
- /**
124
- * Property to read if filelist contains errors or not
125
- */
126
- valid: boolean;
127
- watchValidHandler(newValue: boolean, oldValue: boolean): void;
128
- /**
129
- * Property to change labelDefaults defaults on the component.
130
- * normally you would handle these strings on an application level and override @label when needed
131
- */
132
- labelDefaults: DuetLangObject;
133
- /**
134
- * Label for the input.
135
- * @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
136
- */
137
- label: string;
138
- /**
139
- * Property to change descriptionDefaults defaults on the component.
140
- * normally you would handle these strings on an application level and override @label when needed
141
- */
142
- descriptionDefaults: DuetLangObject;
143
- /**
144
- * Description for the upload component.
145
- * @default ...
146
- */
147
- description: string;
148
- /**
149
- * Defaults for the filelist's empty state.
150
- * @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
151
- */
152
- fileListEmptyDefaults: DuetLangObject;
153
- /**
154
- * Label for the filelist's empty state.
155
- * @default { fi: "Ei vielä lisättyjä tiedostoja.",sv: "Inga filer har lagts till ännu.",en: "No files added yet."}
156
- */
157
- fileListEmpty: string;
158
- /**
159
- * Display the input in error state along with an error message.
160
- */
161
- error: string;
162
- /**
163
- * Visually hide the label, but still show it to screen readers.
164
- */
165
- labelHidden: boolean;
166
- /**
167
- * Name of the upload component.
168
- */
169
- name: string;
170
- /**
171
- * if set, allows capture of media from user camera / microphone
172
- * The capture attribute value is a string that specifies which camera to use for capture
173
- * of image or video data, if the accept attribute indicates that the input should be of
174
- * one of those types. A value of user indicates that the user-facing camera and/or
175
- * microphone should be used. A value of environment specifies that the outward-facing
176
- * camera and/or microphone should be used. If this attribute is missing, the user agent
177
- * is free to decide on its own what to do. If the requested facing mode isn't available,
178
- * the user agent may fall back to its preferred default mode.
179
- */
180
- capture: string | boolean;
181
- /**
182
- * Use maxBytes to specify the maximum size in Bytes of a file that can be uploaded.
183
- */
184
- maxBytes: number;
185
- /**
186
- * Use maxBytesTotal to specify the maximum size in Bytes of All files combined that can be uploaded.
187
- */
188
- maxBytesTotal: number;
189
- /**
190
- * Use maxFiles to specify the maximum amount of files that can be uploaded
191
- */
192
- maxFiles: number;
193
- /**
194
- * A string of commaseperated file type values that are allowed
195
- * @example: .pdf,.doc,.docx
196
- */
197
- allowedExtensions: string;
198
- /**
199
- * A string of commaseperated mime type values that are allowed
200
- * @example: image/*,application/msword,
201
- */
202
- allowedMimetypes: string;
203
- /**
204
- * Use multiple to allow the user to select multiple files when uploading
205
- */
206
- multiple: boolean;
207
- /**
208
- * Use limitSelection to enforce the value in allowedExtension & allowedMimetypes when selecting files,
209
- * by default this is off, setting this to true will limit the users choices to what has been explicitly set
210
- */
211
- limitSelection: boolean;
212
- /**
213
- * Value of the input.
214
- */
215
- value: string;
216
- /**
217
- * Emitted when the value has changed.
218
- */
219
- duetChange: EventEmitter<DuetUploadEvent>;
220
- /**
221
- * Emitted when the input loses focus.
222
- */
223
- duetBlur: EventEmitter<DuetUploadEvent>;
224
- /**
225
- * Emitted when the input has focus.
226
- */
227
- duetFocus: EventEmitter<DuetUploadEvent>;
228
- /**
229
- * Emitted when the current upload batch finishes
230
- */
231
- duetDone: EventEmitter<DuetUploadEvent>;
232
- /**
233
- * Emitted when the current validation state changes internally
234
- */
235
- duetState: EventEmitter<DuetUploadEvent>;
236
- /**
237
- * Emitted when a user clicks delete to delete an uploaded file, or a file entry with error
238
- */
239
- duetDelete: EventEmitter<DuetUploadEvent>;
240
- /**
241
- * Emitted when a user clicks cancel on an upload in progress
242
- */
243
- duetCancel: EventEmitter<DuetUploadEvent>;
244
- /**
245
- * Emitted when the file progress is updated.
246
- */
247
- duetProgress: EventEmitter<DuetUploadEvent>;
248
- /**
249
- * Emitted when the user clicks the upload button
250
- */
251
- duetUpload: EventEmitter<DuetUploadEvent>;
252
- /**
253
- * Component lifecycle events.
254
- */
255
- componentWillLoad(): void;
256
- componentWillRender(): void;
257
- /**
258
- * Private functions
259
- */
260
- private kick;
261
- private genHashName;
262
- private updateValueInMap;
263
- private updateProgress;
264
- private trackProgress;
265
- private getFilesAsArray;
266
- private resetFormFields;
267
- private getI18nError;
268
- /**
269
- * Eventlisteners for the XHR requests
270
- */
271
- private transferComplete;
272
- private transferDone;
273
- private transferDoneWithFailure;
274
- private transferFailed;
275
- private transferCanceled;
276
- private validateTotals;
277
- /**
278
- * XHR request utilities
279
- */
280
- private makeXHRPostRequest;
281
- private makeXHRDeleteRequest;
282
- /**
283
- * Component event handling.
284
- */
285
- private onChange;
286
- private onDelete;
287
- private onCancel;
288
- private onUpload;
289
- private onBlur;
290
- private onProgress;
291
- private onFocus;
292
- private onDone;
293
- private startUpload;
294
- /**
295
- * Sets focus on the specified `duet-input`. Use this method instead of the global
296
- * `input.focus()`.
297
- */
298
- setFocus(options?: FocusOptions): Promise<void>;
299
- /**
300
- * Get list of files, divided in errors and valid sections
301
- */
302
- getFiles(): Promise<false | {
303
- valid: any[];
304
- invalid: any[];
305
- }>;
306
- /**
307
- * render() function
308
- * Always the last one in the class.
309
- */
310
- render(): any;
311
- }
@@ -1,7 +0,0 @@
1
- import { DuetLangObject } from "../../utils/language-utils";
2
- export declare type DuetUploadErrorCode = {
3
- type: string | undefined;
4
- system_message: string | undefined;
5
- message: DuetLangObject | undefined;
6
- };
7
- export declare const getError: (code: string) => DuetUploadErrorCode;
@@ -1,2 +0,0 @@
1
- /** list of mock File elements to pass the duet-upload component */
2
- export declare function getBrowsedFiles(): Map<any, any>;
@@ -1 +0,0 @@
1
- export declare const formatBytes: (bytes: any, decimals?: number) => string;
@@ -1,12 +0,0 @@
1
- export declare type DuetXhrRequestOptions = {
2
- type: "POST" | "DELETE";
3
- xhr: XMLHttpRequest;
4
- argument: string | null;
5
- uri: string;
6
- headers: Record<string, string> | null;
7
- };
8
- export declare type failureHandler = (xhr: XMLHttpRequest, name: string, status: XMLHttpRequest["status"]) => void;
9
- export declare type successHandler = (xhr: XMLHttpRequest, name: string, status: XMLHttpRequest["status"]) => void;
10
- export declare type progressTracker = (name: string) => void;
11
- export declare type DuetXhrRequest = (payload: Record<string, any>, options: Partial<DuetXhrRequestOptions>, onFailure: failureHandler, onSuccess: successHandler, onProgress: progressTracker) => XMLHttpRequest;
12
- export declare const makeXhrRequest: (payload: any, options: any, onFailure: any, onSuccess: any, onProgress: any) => DuetXhrRequest;