@duetds/components 4.32.0 → 4.34.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 (388) hide show
  1. package/hydrate/index.js +2367 -244
  2. package/lib/cjs/{dom-a28e5c5f.js → dom-52a4f07a.js} +1 -1
  3. package/lib/cjs/duet-alert.cjs.entry.js +2 -2
  4. package/lib/cjs/duet-badge.cjs.entry.js +1 -1
  5. package/lib/cjs/duet-button_2.cjs.entry.js +4 -4
  6. package/lib/cjs/duet-caption_4.cjs.entry.js +18 -11
  7. package/lib/cjs/duet-card.cjs.entry.js +3 -3
  8. package/lib/cjs/duet-checkbox.cjs.entry.js +2 -2
  9. package/lib/cjs/duet-choice_2.cjs.entry.js +39 -18
  10. package/lib/cjs/duet-collapsible.cjs.entry.js +5 -450
  11. package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
  12. package/lib/cjs/duet-date-picker.cjs.entry.js +7 -7
  13. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
  14. package/lib/cjs/duet-editable-table-button.cjs.entry.js +96 -0
  15. package/lib/cjs/duet-editable-table_4.cjs.entry.js +1520 -0
  16. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
  17. package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
  18. package/lib/cjs/duet-footer.cjs.entry.js +3 -3
  19. package/lib/cjs/duet-grid_2.cjs.entry.js +69 -4
  20. package/lib/cjs/duet-header_2.cjs.entry.js +216 -49
  21. package/lib/cjs/duet-hero.cjs.entry.js +2 -2
  22. package/lib/cjs/duet-icon.cjs.entry.js +8 -6
  23. package/lib/cjs/duet-input_2.cjs.entry.js +8 -9
  24. package/lib/cjs/duet-layout.cjs.entry.js +1 -1
  25. package/lib/cjs/duet-list_2.cjs.entry.js +3 -3
  26. package/lib/cjs/duet-modal.cjs.entry.js +3 -3
  27. package/lib/cjs/duet-notification_2.cjs.entry.js +3 -3
  28. package/lib/cjs/duet-number-input.cjs.entry.js +2 -2
  29. package/lib/cjs/duet-progress.cjs.entry.js +75 -0
  30. package/lib/cjs/duet-radio_2.cjs.entry.js +2 -2
  31. package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
  32. package/lib/cjs/duet-select.cjs.entry.js +5 -5
  33. package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
  34. package/lib/cjs/duet-tab_2.cjs.entry.js +3 -3
  35. package/lib/cjs/duet-textarea.cjs.entry.js +5 -5
  36. package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
  37. package/lib/cjs/duet-tooltip.cjs.entry.js +2 -2
  38. package/lib/cjs/duet-tray.cjs.entry.js +3 -3
  39. package/lib/cjs/duet-upload-aria-status.cjs.entry.js +100 -0
  40. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  41. package/lib/cjs/duet.cjs.js +4 -4
  42. package/lib/cjs/{focus-utils-55b5a616.js → focus-utils-480ea4e0.js} +1 -1
  43. package/lib/cjs/form-search-d61b2843.js +8 -0
  44. package/lib/cjs/{index-03ed1f55.js → index-6966a494.js} +5 -2
  45. package/lib/cjs/{language-utils-48b8860b.js → language-utils-aa282901.js} +6 -2
  46. package/lib/cjs/loader.cjs.js +3 -3
  47. package/lib/cjs/{shadow-css-6560c90c.js → shadow-css-e1b62a99.js} +9 -10
  48. package/lib/cjs/token-utils-05bd23b4.js +77 -0
  49. package/lib/cjs/tokens-8596cece.js +459 -0
  50. package/lib/cjs/{tokens.module-53b3bd92.js → tokens.module-6b2df1c2.js} +2 -0
  51. package/lib/cjs/{watch-options-3877c082.js → watch-options-d88afac0.js} +29 -6
  52. package/lib/collection/collection-manifest.json +17 -3
  53. package/lib/collection/components/duet-checkbox/duet-checkbox.css +1 -1
  54. package/lib/collection/components/duet-choice/duet-choice.js +94 -21
  55. package/lib/collection/components/duet-collapsible/duet-collapsible.js +4 -1
  56. package/lib/collection/components/duet-date-picker/duet-date-picker.js +9 -9
  57. package/lib/collection/components/duet-editable-table/duet-editable-table-button.css +32 -0
  58. package/lib/collection/components/duet-editable-table/duet-editable-table-button.js +225 -0
  59. package/lib/collection/components/duet-editable-table/duet-editable-table-item.css +36 -0
  60. package/lib/collection/components/duet-editable-table/duet-editable-table-item.js +225 -0
  61. package/lib/collection/components/duet-editable-table/duet-editable-table-tabledata.js +13 -0
  62. package/lib/collection/components/duet-editable-table/duet-editable-table.css +16 -0
  63. package/lib/collection/components/duet-editable-table/duet-editable-table.js +404 -0
  64. package/lib/collection/components/duet-footer/duet-footer.css +1 -0
  65. package/lib/collection/components/duet-grid/duet-grid.js +74 -6
  66. package/lib/collection/components/duet-header/duet-header-dropdown.js +27 -0
  67. package/lib/collection/components/duet-header/duet-header-hamburger.js +9 -0
  68. package/lib/collection/components/duet-header/duet-header-icon.js +9 -0
  69. package/lib/collection/components/duet-header/duet-header.css +272 -39
  70. package/lib/collection/components/duet-header/duet-header.js +310 -122
  71. package/lib/collection/components/duet-heading/duet-heading.css +3 -0
  72. package/lib/collection/components/duet-heading/duet-heading.js +7 -6
  73. package/lib/collection/components/duet-icon/duet-icon.js +5 -3
  74. package/lib/collection/components/duet-input/duet-input.css +15 -0
  75. package/lib/collection/components/duet-input/duet-input.js +4 -4
  76. package/lib/collection/components/duet-link/duet-link.js +4 -1
  77. package/lib/collection/components/duet-list-item/duet-list-item.css +1 -1
  78. package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.css +4 -3
  79. package/lib/collection/components/duet-paragraph/duet-paragraph.css +6 -0
  80. package/lib/collection/components/duet-paragraph/duet-paragraph.js +34 -3
  81. package/lib/collection/components/duet-progress/duet-progress.css +103 -0
  82. package/lib/collection/components/duet-progress/duet-progress.js +240 -0
  83. package/lib/collection/components/duet-select/duet-select.css +15 -0
  84. package/lib/collection/components/duet-select/duet-select.js +3 -3
  85. package/lib/collection/components/duet-tab-group/duet-tab-group.css +2 -2
  86. package/lib/collection/components/duet-table/duet-table.css +42 -17
  87. package/lib/collection/components/duet-table/duet-table.js +2 -2
  88. package/lib/collection/components/duet-textarea/duet-textarea.css +19 -0
  89. package/lib/collection/components/duet-textarea/duet-textarea.js +5 -4
  90. package/lib/collection/components/duet-upload/duet-upload.css +64 -0
  91. package/lib/collection/components/duet-upload/duet-upload.js +1885 -0
  92. package/lib/collection/components/duet-upload/errorcodes.utils.js +32 -0
  93. package/lib/collection/components/duet-upload/mock.helpers.js +91 -0
  94. package/lib/collection/components/duet-upload/upload-editable-item-error.js +16 -0
  95. package/lib/collection/components/duet-upload/upload-editable-item-inprogres.js +8 -0
  96. package/lib/collection/components/duet-upload/upload-editable-item-success.js +30 -0
  97. package/lib/collection/components/duet-upload/upload-validators.js +93 -0
  98. package/lib/collection/components/duet-upload/upload.helpers.js +13 -0
  99. package/lib/collection/components/duet-upload/xhr.helpers.js +30 -0
  100. package/lib/collection/components/duet-upload-aria-status/duet-upload-aria-status.js +217 -0
  101. package/lib/collection/utils/js-utils.js +12 -0
  102. package/lib/collection/utils/language-utils.js +6 -3
  103. package/lib/collection/utils/template-utils.js +33 -0
  104. package/lib/collection/utils/token-utils.js +67 -14
  105. package/lib/collection/utils/watch-options.js +35 -6
  106. package/lib/custom-elements-bundle/index.d.ts +36 -0
  107. package/lib/custom-elements-bundle/index.js +2309 -334
  108. package/lib/duet/duet.esm.js +1 -1
  109. package/lib/duet/duet.js +1 -1
  110. package/lib/duet/{p-92103298.system.entry.js → p-07f43530.system.entry.js} +1 -1
  111. package/lib/duet/{p-cc0bd28f.system.entry.js → p-093bca2f.system.entry.js} +1 -1
  112. package/lib/duet/{p-a678da8c.entry.js → p-0aaf86ba.entry.js} +1 -1
  113. package/lib/duet/{p-94a5fd74.system.entry.js → p-0b0a05ed.system.entry.js} +1 -1
  114. package/lib/duet/{p-00eac879.system.entry.js → p-0be1c660.system.entry.js} +1 -1
  115. package/lib/duet/{p-3b3bac3f.system.entry.js → p-0d66e11b.system.entry.js} +1 -1
  116. package/lib/duet/{p-7331f2fe.system.entry.js → p-0de430e1.system.entry.js} +1 -1
  117. package/lib/duet/{p-3618aaee.entry.js → p-0ef8d711.entry.js} +1 -1
  118. package/lib/duet/p-12721178.js +4 -0
  119. package/lib/duet/{p-c19094dd.entry.js → p-12a08d77.entry.js} +1 -1
  120. package/lib/duet/p-15c9a17c.entry.js +4 -0
  121. package/lib/duet/{p-9cdd361e.js → p-183726f7.js} +0 -0
  122. package/lib/duet/{p-b75c5f13.entry.js → p-18c3eb54.entry.js} +1 -1
  123. package/lib/duet/{p-9542c540.entry.js → p-1b591fa4.entry.js} +1 -1
  124. package/lib/duet/{p-f364ce8b.system.entry.js → p-1bd0f4eb.system.entry.js} +1 -1
  125. package/lib/duet/p-2764f081.js +4 -0
  126. package/lib/duet/p-27bd8744.system.entry.js +4 -0
  127. package/lib/duet/p-289a31cb.entry.js +4 -0
  128. package/lib/duet/{p-8c511832.system.entry.js → p-29b352db.system.entry.js} +1 -1
  129. package/lib/duet/p-2a00f231.system.entry.js +4 -0
  130. package/lib/duet/p-3215e07e.system.entry.js +4 -0
  131. package/lib/duet/{p-ed479d09.system.entry.js → p-338b9955.system.entry.js} +1 -1
  132. package/lib/duet/{p-8740fa38.entry.js → p-33de1029.entry.js} +1 -1
  133. package/lib/duet/p-34ebff3b.entry.js +4 -0
  134. package/lib/duet/{p-b6a0caf8.system.entry.js → p-379d416f.system.entry.js} +1 -1
  135. package/lib/duet/{p-0b9b6393.entry.js → p-39a12eb9.entry.js} +1 -1
  136. package/lib/duet/{p-8652a7ab.system.entry.js → p-39fd8b43.system.entry.js} +1 -1
  137. package/lib/duet/{p-ffc2ffff.entry.js → p-3bafdf7c.entry.js} +1 -1
  138. package/lib/duet/{p-4fcbcecd.system.entry.js → p-3c1ce7e2.system.entry.js} +1 -1
  139. package/lib/duet/p-3da6b84e.entry.js +4 -0
  140. package/lib/duet/p-43c49a72.entry.js +4 -0
  141. package/lib/duet/{p-9f0f5674.entry.js → p-44f4b8ff.entry.js} +1 -1
  142. package/lib/duet/{p-b0bbbdba.system.entry.js → p-4c5ac0c2.system.entry.js} +1 -1
  143. package/lib/duet/p-50b4fb2c.js +4 -0
  144. package/lib/duet/p-51f7ae72.entry.js +4 -0
  145. package/lib/duet/p-52621211.js +15 -0
  146. package/lib/duet/{p-2a3411b5.system.entry.js → p-5443c9ca.system.entry.js} +1 -1
  147. package/lib/duet/{p-abd3bfb4.system.entry.js → p-5610db77.system.entry.js} +1 -1
  148. package/lib/duet/{p-2c0dd9ba.system.entry.js → p-5b409bfb.system.entry.js} +1 -1
  149. package/lib/duet/{p-807b2087.entry.js → p-6353407f.entry.js} +1 -1
  150. package/lib/duet/{p-a89e88a3.js → p-64bf94ee.js} +1 -1
  151. package/lib/duet/{p-2c679963.entry.js → p-64e915ae.entry.js} +1 -1
  152. package/lib/duet/{p-432ba72e.system.entry.js → p-6c237f21.system.entry.js} +1 -1
  153. package/lib/duet/p-6c8521f6.system.entry.js +4 -0
  154. package/lib/duet/{p-a962c8c1.system.js → p-6e4fd6ba.system.js} +0 -0
  155. package/lib/duet/p-70fafc98.system.js +4 -0
  156. package/lib/duet/{p-8002a095.entry.js → p-7347f4ac.entry.js} +1 -1
  157. package/lib/duet/{p-d13874cb.entry.js → p-781bd6db.entry.js} +1 -1
  158. package/lib/duet/{p-5a817929.system.entry.js → p-78e8a689.system.entry.js} +1 -1
  159. package/lib/duet/p-8143f3de.js +4 -0
  160. package/lib/duet/p-81e855e4.system.js +4 -0
  161. package/lib/duet/{p-84ece735.entry.js → p-8224d768.entry.js} +1 -1
  162. package/lib/duet/{p-43dde575.system.entry.js → p-848bb1c2.system.entry.js} +1 -1
  163. package/lib/duet/{p-1391ec53.entry.js → p-880a4afe.entry.js} +1 -1
  164. package/lib/duet/p-8c375429.entry.js +4 -0
  165. package/lib/duet/p-8cb71174.system.entry.js +4 -0
  166. package/lib/duet/p-8d7b68c4.entry.js +4 -0
  167. package/lib/duet/p-8f477bd6.system.js +4 -0
  168. package/lib/duet/p-969c6395.system.entry.js +4 -0
  169. package/lib/duet/p-9c234242.system.entry.js +4 -0
  170. package/lib/duet/{p-f13a0883.entry.js → p-9d7b9084.entry.js} +1 -1
  171. package/lib/duet/p-a0544097.system.entry.js +4 -0
  172. package/lib/duet/p-a16a58c1.system.js +4 -0
  173. package/lib/duet/{p-fb898d94.system.entry.js → p-a4a16d03.system.entry.js} +1 -1
  174. package/lib/duet/p-a4e3b44b.entry.js +4 -0
  175. package/lib/duet/{p-977f2826.entry.js → p-a91673cf.entry.js} +1 -1
  176. package/lib/duet/p-a926944f.entry.js +4 -0
  177. package/lib/duet/{p-2826f987.js → p-ad07f399.js} +1 -1
  178. package/lib/duet/p-b08bce4c.entry.js +4 -0
  179. package/lib/duet/{p-ec3eef3a.entry.js → p-b48a5f80.entry.js} +1 -1
  180. package/lib/duet/p-bb3e3777.entry.js +4 -0
  181. package/lib/duet/{p-fbb7d194.entry.js → p-bbe33d02.entry.js} +1 -1
  182. package/lib/duet/p-be8e1c48.system.entry.js +4 -0
  183. package/lib/duet/{p-68d09837.system.entry.js → p-c56c73ee.system.entry.js} +1 -1
  184. package/lib/duet/p-c63bdc6a.system.entry.js +4 -0
  185. package/lib/duet/{p-c723d36e.system.js → p-c83685a6.system.js} +1 -1
  186. package/lib/duet/p-c8dfc958.system.entry.js +4 -0
  187. package/lib/duet/{p-6cf41bfe.system.entry.js → p-c92f601f.system.entry.js} +1 -1
  188. package/lib/duet/p-d004da5f.js +4 -0
  189. package/lib/duet/p-d49416f8.entry.js +4 -0
  190. package/lib/duet/{p-7a868085.entry.js → p-d581d82d.entry.js} +1 -1
  191. package/lib/duet/p-d6bb4301.entry.js +4 -0
  192. package/lib/duet/p-d9aadc15.entry.js +4 -0
  193. package/lib/duet/p-ddb6344c.system.js +4 -0
  194. package/lib/duet/{p-3040debf.entry.js → p-dde63979.entry.js} +1 -1
  195. package/lib/duet/p-e15ccddc.system.entry.js +4 -0
  196. package/lib/duet/{p-0f2a478e.entry.js → p-e1be37a6.entry.js} +1 -1
  197. package/lib/duet/p-e5c1751e.system.js +16 -0
  198. package/lib/duet/{p-b9683731.entry.js → p-e9209e9f.entry.js} +1 -1
  199. package/lib/duet/p-eb55ccd2.system.js +4 -0
  200. package/lib/duet/{p-b374d7c2.system.js → p-ee1ba0d4.system.js} +1 -1
  201. package/lib/duet/{p-57cb58d4.system.entry.js → p-f4a29a8a.system.entry.js} +2 -2
  202. package/lib/duet/p-f8a0bd32.system.entry.js +4 -0
  203. package/lib/duet/p-f9599dd9.system.entry.js +4 -0
  204. package/lib/duet/p-fa99eaa4.system.js +4 -0
  205. package/lib/duet/p-fd7018e9.js +4 -0
  206. package/lib/duet/{p-19c28d99.system.entry.js → p-fe0cca67.system.entry.js} +1 -1
  207. package/lib/esm/{dom-8516b24e.js → dom-5d060ace.js} +1 -1
  208. package/lib/esm/duet-alert.entry.js +2 -2
  209. package/lib/esm/duet-badge.entry.js +1 -1
  210. package/lib/esm/duet-button_2.entry.js +4 -4
  211. package/lib/esm/duet-caption_4.entry.js +18 -11
  212. package/lib/esm/duet-card.entry.js +3 -3
  213. package/lib/esm/duet-checkbox.entry.js +2 -2
  214. package/lib/esm/duet-choice_2.entry.js +40 -19
  215. package/lib/esm/duet-collapsible.entry.js +4 -449
  216. package/lib/esm/duet-cookie-consent.entry.js +1 -1
  217. package/lib/esm/duet-date-picker.entry.js +7 -7
  218. package/lib/esm/duet-divider_2.entry.js +1 -1
  219. package/lib/esm/duet-editable-table-button.entry.js +92 -0
  220. package/lib/esm/duet-editable-table_4.entry.js +1513 -0
  221. package/lib/esm/duet-empty-state.entry.js +1 -1
  222. package/lib/esm/duet-fieldset.entry.js +1 -1
  223. package/lib/esm/duet-footer.entry.js +3 -3
  224. package/lib/esm/duet-grid_2.entry.js +69 -4
  225. package/lib/esm/duet-header_2.entry.js +216 -49
  226. package/lib/esm/duet-hero.entry.js +2 -2
  227. package/lib/esm/duet-icon.entry.js +8 -6
  228. package/lib/esm/duet-input_2.entry.js +7 -8
  229. package/lib/esm/duet-layout.entry.js +1 -1
  230. package/lib/esm/duet-list_2.entry.js +3 -3
  231. package/lib/esm/duet-modal.entry.js +3 -3
  232. package/lib/esm/duet-notification_2.entry.js +3 -3
  233. package/lib/esm/duet-number-input.entry.js +2 -2
  234. package/lib/esm/duet-progress.entry.js +71 -0
  235. package/lib/esm/duet-radio_2.entry.js +2 -2
  236. package/lib/esm/duet-range-slider.entry.js +2 -2
  237. package/lib/esm/duet-select.entry.js +5 -5
  238. package/lib/esm/duet-step_2.entry.js +1 -1
  239. package/lib/esm/duet-tab_2.entry.js +3 -3
  240. package/lib/esm/duet-textarea.entry.js +5 -5
  241. package/lib/esm/duet-toggle.entry.js +1 -1
  242. package/lib/esm/duet-tooltip.entry.js +2 -2
  243. package/lib/esm/duet-tray.entry.js +3 -3
  244. package/lib/esm/duet-upload-aria-status.entry.js +96 -0
  245. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  246. package/lib/esm/duet.js +4 -4
  247. package/lib/esm/{focus-utils-6a282066.js → focus-utils-48837cfa.js} +1 -1
  248. package/lib/esm/form-search-ea8e19ae.js +6 -0
  249. package/lib/esm/{index-3a265449.js → index-80be4170.js} +5 -2
  250. package/lib/esm/{language-utils-d5c38f65.js → language-utils-344d894c.js} +6 -3
  251. package/lib/esm/loader.js +3 -3
  252. package/lib/esm/{shadow-css-9178c864.js → shadow-css-13d024f4.js} +9 -10
  253. package/lib/esm/token-utils-75f78ca4.js +75 -0
  254. package/lib/esm/tokens-e110dc89.js +453 -0
  255. package/lib/esm/{tokens.module-edb66c04.js → tokens.module-49cbf963.js} +3 -1
  256. package/lib/esm/watch-options-dd55bce8.js +57 -0
  257. package/lib/esm-es5/{dom-8516b24e.js → dom-5d060ace.js} +0 -0
  258. package/lib/esm-es5/duet-alert.entry.js +1 -1
  259. package/lib/esm-es5/duet-badge.entry.js +1 -1
  260. package/lib/esm-es5/duet-button_2.entry.js +1 -1
  261. package/lib/esm-es5/duet-caption_4.entry.js +2 -2
  262. package/lib/esm-es5/duet-card.entry.js +1 -1
  263. package/lib/esm-es5/duet-checkbox.entry.js +1 -1
  264. package/lib/esm-es5/duet-choice_2.entry.js +2 -2
  265. package/lib/esm-es5/duet-collapsible.entry.js +2 -2
  266. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  267. package/lib/esm-es5/duet-date-picker.entry.js +1 -1
  268. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  269. package/lib/esm-es5/duet-editable-table-button.entry.js +4 -0
  270. package/lib/esm-es5/duet-editable-table_4.entry.js +4 -0
  271. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  272. package/lib/esm-es5/duet-fieldset.entry.js +1 -1
  273. package/lib/esm-es5/duet-footer.entry.js +1 -1
  274. package/lib/esm-es5/duet-grid_2.entry.js +2 -2
  275. package/lib/esm-es5/duet-header_2.entry.js +2 -2
  276. package/lib/esm-es5/duet-hero.entry.js +1 -1
  277. package/lib/esm-es5/duet-icon.entry.js +1 -1
  278. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  279. package/lib/esm-es5/duet-layout.entry.js +1 -1
  280. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  281. package/lib/esm-es5/duet-modal.entry.js +1 -1
  282. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  283. package/lib/esm-es5/duet-number-input.entry.js +1 -1
  284. package/lib/esm-es5/duet-progress.entry.js +4 -0
  285. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  286. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  287. package/lib/esm-es5/duet-select.entry.js +1 -1
  288. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  289. package/lib/esm-es5/duet-tab_2.entry.js +2 -2
  290. package/lib/esm-es5/duet-textarea.entry.js +1 -1
  291. package/lib/esm-es5/duet-toggle.entry.js +1 -1
  292. package/lib/esm-es5/duet-tooltip.entry.js +1 -1
  293. package/lib/esm-es5/duet-tray.entry.js +1 -1
  294. package/lib/esm-es5/duet-upload-aria-status.entry.js +4 -0
  295. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  296. package/lib/esm-es5/duet.js +1 -1
  297. package/lib/esm-es5/focus-utils-48837cfa.js +4 -0
  298. package/lib/esm-es5/form-search-ea8e19ae.js +4 -0
  299. package/lib/esm-es5/index-80be4170.js +4 -0
  300. package/lib/esm-es5/{language-utils-d5c38f65.js → language-utils-344d894c.js} +1 -1
  301. package/lib/esm-es5/loader.js +1 -1
  302. package/lib/esm-es5/shadow-css-13d024f4.js +15 -0
  303. package/lib/esm-es5/token-utils-75f78ca4.js +4 -0
  304. package/lib/esm-es5/tokens-e110dc89.js +4 -0
  305. package/lib/esm-es5/tokens.module-49cbf963.js +4 -0
  306. package/lib/esm-es5/watch-options-dd55bce8.js +4 -0
  307. package/lib/types/common-types.d.ts +0 -1
  308. package/lib/types/components/duet-choice/duet-choice.d.ts +20 -1
  309. package/lib/types/components/duet-collapsible/duet-collapsible.d.ts +3 -0
  310. package/lib/types/components/duet-date-picker/duet-date-picker.d.ts +5 -5
  311. package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +73 -0
  312. package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +76 -0
  313. package/lib/types/components/duet-editable-table/duet-editable-table-tabledata.d.ts +8 -0
  314. package/lib/types/components/duet-editable-table/duet-editable-table.d.ts +94 -0
  315. package/lib/types/components/duet-grid/duet-grid.d.ts +17 -2
  316. package/lib/types/components/duet-header/duet-header-dropdown.d.ts +16 -0
  317. package/lib/types/components/duet-header/duet-header-hamburger.d.ts +2 -0
  318. package/lib/types/components/duet-header/duet-header-icon.d.ts +8 -0
  319. package/lib/types/components/duet-header/duet-header.d.ts +41 -4
  320. package/lib/types/components/duet-heading/duet-heading.d.ts +2 -2
  321. package/lib/types/components/duet-link/duet-link.d.ts +3 -0
  322. package/lib/types/components/duet-paragraph/duet-paragraph.d.ts +9 -1
  323. package/lib/types/components/duet-progress/duet-progress.d.ts +64 -0
  324. package/lib/types/components/duet-table/duet-table.d.ts +1 -1
  325. package/lib/types/components/duet-upload/duet-upload.d.ts +408 -0
  326. package/lib/types/components/duet-upload/errorcodes.utils.d.ts +8 -0
  327. package/lib/types/components/duet-upload/mock.helpers.d.ts +2 -0
  328. package/lib/types/components/duet-upload/upload-editable-item-error.d.ts +7 -0
  329. package/lib/types/components/duet-upload/upload-editable-item-inprogres.d.ts +7 -0
  330. package/lib/types/components/duet-upload/upload-editable-item-success.d.ts +8 -0
  331. package/lib/types/components/duet-upload/upload-validators.d.ts +12 -0
  332. package/lib/types/components/duet-upload/upload.helpers.d.ts +1 -0
  333. package/lib/types/components/duet-upload/xhr.helpers.d.ts +18 -0
  334. package/lib/types/components/duet-upload-aria-status/duet-upload-aria-status.d.ts +49 -0
  335. package/lib/types/components.d.ts +835 -29
  336. package/lib/types/stencil-public-runtime.d.ts +6 -4
  337. package/lib/types/utils/js-utils.d.ts +1 -0
  338. package/lib/types/utils/language-utils.d.ts +5 -1
  339. package/lib/types/utils/template-utils.d.ts +13 -0
  340. package/lib/types/utils/token-utils.d.ts +8 -2
  341. package/lib/types/utils/watch-options.d.ts +2 -0
  342. package/package.json +13 -13
  343. package/lib/cjs/duet-table.cjs.entry.js +0 -132
  344. package/lib/cjs/token-utils-13e5d13e.js +0 -30
  345. package/lib/duet/p-0058512b.js +0 -4
  346. package/lib/duet/p-08729381.entry.js +0 -4
  347. package/lib/duet/p-0b00e8d6.system.js +0 -16
  348. package/lib/duet/p-15922601.system.js +0 -4
  349. package/lib/duet/p-194e25ce.system.entry.js +0 -4
  350. package/lib/duet/p-1d87ea02.system.entry.js +0 -4
  351. package/lib/duet/p-2d1e2b23.system.entry.js +0 -4
  352. package/lib/duet/p-322d1c38.js +0 -4
  353. package/lib/duet/p-40d68321.entry.js +0 -4
  354. package/lib/duet/p-418b2ce7.system.js +0 -4
  355. package/lib/duet/p-43e39d98.system.js +0 -4
  356. package/lib/duet/p-4603830b.entry.js +0 -4
  357. package/lib/duet/p-52d7fbec.entry.js +0 -4
  358. package/lib/duet/p-60478325.system.entry.js +0 -4
  359. package/lib/duet/p-64ed7add.entry.js +0 -4
  360. package/lib/duet/p-6a356ab1.system.js +0 -4
  361. package/lib/duet/p-72fd384a.entry.js +0 -4
  362. package/lib/duet/p-753b406c.entry.js +0 -4
  363. package/lib/duet/p-76c00d0c.entry.js +0 -4
  364. package/lib/duet/p-85fe1132.js +0 -4
  365. package/lib/duet/p-8c8e82aa.system.js +0 -4
  366. package/lib/duet/p-9a89ec39.js +0 -4
  367. package/lib/duet/p-a11df1b6.js +0 -15
  368. package/lib/duet/p-a1eccee1.system.entry.js +0 -4
  369. package/lib/duet/p-ade33230.entry.js +0 -4
  370. package/lib/duet/p-b04d738f.system.entry.js +0 -4
  371. package/lib/duet/p-cb827bb7.entry.js +0 -4
  372. package/lib/duet/p-d85fba2c.system.entry.js +0 -4
  373. package/lib/duet/p-dfa90f8a.system.entry.js +0 -4
  374. package/lib/duet/p-e6b9bd1d.entry.js +0 -4
  375. package/lib/duet/p-ee64d6be.system.entry.js +0 -4
  376. package/lib/duet/p-f113671b.system.entry.js +0 -4
  377. package/lib/duet/p-f2f04396.entry.js +0 -4
  378. package/lib/duet/p-fc6624fe.system.entry.js +0 -4
  379. package/lib/esm/duet-table.entry.js +0 -128
  380. package/lib/esm/token-utils-5a35377f.js +0 -28
  381. package/lib/esm/watch-options-de55ea78.js +0 -35
  382. package/lib/esm-es5/duet-table.entry.js +0 -4
  383. package/lib/esm-es5/focus-utils-6a282066.js +0 -4
  384. package/lib/esm-es5/index-3a265449.js +0 -4
  385. package/lib/esm-es5/shadow-css-9178c864.js +0 -15
  386. package/lib/esm-es5/token-utils-5a35377f.js +0 -4
  387. package/lib/esm-es5/tokens.module-edb66c04.js +0 -4
  388. package/lib/esm-es5/watch-options-de55ea78.js +0 -4
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { getLocaleString } from "../../utils/language-utils";
5
+ import errorCodes from "./errorcodes.json";
6
+ export const getError = (code) => {
7
+ let error = {
8
+ type: undefined,
9
+ system_message: undefined,
10
+ message: undefined,
11
+ };
12
+ error = errorCodes.filter(errorItem => {
13
+ // the == is intentional we may be comparing numbers to strings - and that is ok here
14
+ return errorItem.type == code;
15
+ })[0];
16
+ if (!error) {
17
+ error = errorCodes.filter(errorItem => {
18
+ return errorItem.type === "default";
19
+ })[0];
20
+ }
21
+ return error;
22
+ };
23
+ export const getI18nError = (errorCode) => {
24
+ const errorFromJson = getError(errorCode);
25
+ const i18String = getLocaleString(errorFromJson.message);
26
+ if (i18String === "" || !i18String) {
27
+ return errorFromJson.system_message;
28
+ }
29
+ else {
30
+ return i18String;
31
+ }
32
+ };
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ /** list of mock File elements to pass the duet-upload component */
5
+ //mock functions to show uploaded file state
6
+ export function getBrowsedFiles() {
7
+ return fileListFromArray([
8
+ mockFileCreator({
9
+ name: "action-add-circle.svg",
10
+ type: "image/svg",
11
+ size: 234 * 1000,
12
+ lastModified: new Date(),
13
+ error: "400",
14
+ }),
15
+ mockFileCreator({
16
+ name: "action-arrow-down.svg",
17
+ type: "image/svg",
18
+ size: 56 * 10000,
19
+ lastModified: new Date(),
20
+ error: "401",
21
+ }),
22
+ mockFileCreator({
23
+ name: "action-car-transfer.svg",
24
+ type: "image/svg",
25
+ size: 56 * 100,
26
+ lastModified: new Date(),
27
+ error: "403",
28
+ }),
29
+ mockFileCreator({
30
+ name: "action-car-enable.svg",
31
+ type: "image/svg",
32
+ size: 12 * 100000,
33
+ lastModified: new Date(),
34
+ error: "413",
35
+ }),
36
+ mockFileCreator({ name: "action-car-disable.svg", type: "image/svg", size: 23 * 1000, lastModified: new Date() }),
37
+ mockFileCreator({
38
+ name: "action-buy-insurance.svg",
39
+ type: "image/svg",
40
+ size: 11 * 1000,
41
+ lastModified: new Date(),
42
+ error: "duet-upload-101",
43
+ }),
44
+ mockFileCreator({
45
+ name: "category-detached-house.svg",
46
+ type: "image/svg",
47
+ size: 78 * 1000,
48
+ lastModified: new Date(),
49
+ }),
50
+ ]);
51
+ }
52
+ function mockFileCreator({ name, size, type, lastModified, error = undefined }) {
53
+ var file;
54
+ try {
55
+ const blob = new Blob(["a".repeat(size)], { type });
56
+ blob["lastModifiedDate"] = lastModified;
57
+ var file = new File([blob], name, { type });
58
+ }
59
+ catch (e) {
60
+ try {
61
+ var file = new File(["foo"], name, { type });
62
+ }
63
+ catch (e) {
64
+ var file = { name, size };
65
+ }
66
+ }
67
+ return { file, error };
68
+ }
69
+ function fileListFromArray(files) {
70
+ const fileMap = new Map();
71
+ files.forEach(obj => {
72
+ const isValid = !obj.error;
73
+ const fileItem = {
74
+ uid: `${Date.now()}-${Math.random()}`,
75
+ item: obj.file,
76
+ size: obj.file.size,
77
+ valid: isValid,
78
+ error: {
79
+ type: isValid ? undefined : obj.error,
80
+ message: isValid ? undefined : "Random error message",
81
+ system_message: isValid ? undefined : "Random system error message",
82
+ },
83
+ progress: 100,
84
+ deleted: false,
85
+ xhr: false,
86
+ url: `https://cdn.duetds.com/api/icons/2.1.12/lib/assets/${obj.file.name}`,
87
+ };
88
+ fileMap.set(obj.file.name, fileItem);
89
+ });
90
+ return fileMap;
91
+ }
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { h } from "@stencil/core";
5
+ import { getI18nError } from "./errorcodes.utils";
6
+ export const ErrorItem = ({ data }) => {
7
+ const { item, error } = data;
8
+ const { name } = item;
9
+ const { type } = error;
10
+ return (h("span", { class: "duet-upload-item-error", role: "status" },
11
+ h("duet-paragraph", { class: "duet-upload-item-name", color: "danger", margin: "none", weight: "semi-bold" },
12
+ h("duet-icon", { margin: "none", size: "xx-small", name: "messaging-attachment" }),
13
+ " ",
14
+ name),
15
+ h("duet-paragraph", { class: "duet-upload-item-error-label", size: "small", margin: "none", color: "danger" }, getI18nError(type))));
16
+ };
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { h } from "@stencil/core";
5
+ export const ProgressItem = ({ progress, name }) => (h("span", null,
6
+ h("duet-paragraph", { color: "secondary", margin: "none", size: "small" }, name),
7
+ h("duet-spacer", { size: "xx-small" }),
8
+ h("duet-progress", { progress: Math.ceil(progress), "aria-hidden": true })));
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { h } from "@stencil/core";
5
+ import { formatBytes } from "./upload.helpers";
6
+ export const SuccessItem = ({ data, showLinks }) => {
7
+ const { item, size, uploaded, url, meta } = data;
8
+ const { name } = item;
9
+ const ContentName = (h("span", { class: "duet-upload-item-name" },
10
+ h("duet-icon", { margin: "none", size: "xx-small", name: "messaging-attachment" }),
11
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
12
+ name));
13
+ const SizeText = (h("span", { class: "duet-upload-item-size", style: { fontSize: "14px", fontWeight: "400" } },
14
+ "(",
15
+ formatBytes(size),
16
+ ")"));
17
+ const FilenameLine = uploaded && url && showLinks ? (h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
18
+ h("duet-link", { url: url, external: true }, ContentName),
19
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
20
+ SizeText)) : (h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
21
+ ContentName,
22
+ h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
23
+ SizeText));
24
+ const Badges = meta && meta.badges ? (h("span", null,
25
+ h("duet-spacer", { size: "xx-small" }),
26
+ meta.badges.map(badgeText => (h("duet-badge", { color: "primary" }, badgeText))))) : undefined;
27
+ return (h("span", { class: "duet-upload-item-success" },
28
+ h("div", null, FilenameLine),
29
+ Badges));
30
+ };
@@ -0,0 +1,93 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { getLocaleString } from "../../utils/language-utils";
5
+ import { getError } from "./errorcodes.utils";
6
+ export const validateFileExtension = (name, allowedExtensions) => {
7
+ if (!allowedExtensions) {
8
+ return true;
9
+ }
10
+ const ext = name.split(".");
11
+ const validExtension = allowedExtensions.split(",");
12
+ const extension = ext[ext.length - 1];
13
+ return validExtension.includes(extension);
14
+ };
15
+ export const validateFileMime = (type, allowedMimetypes) => {
16
+ if (!allowedMimetypes || !type) {
17
+ return true;
18
+ }
19
+ const validMimeTypes = allowedMimetypes.split(",");
20
+ let valid = false;
21
+ validMimeTypes.forEach(mimeType => {
22
+ const allowedTypes = mimeType.split("/");
23
+ const fileType = type.split("/");
24
+ if (allowedTypes[0] === fileType[0] && (allowedTypes[1] === fileType[1] || allowedTypes[1] === "*")) {
25
+ valid = true;
26
+ }
27
+ });
28
+ return valid;
29
+ };
30
+ export const validateFileSize = (size, maxBytes) => {
31
+ if (!maxBytes || !size) {
32
+ return true;
33
+ }
34
+ return maxBytes >= size;
35
+ };
36
+ export const validateFile = (item, validators) => {
37
+ const { allowedMimetypes, allowedExtensions, maxBytes } = validators;
38
+ let valid = false;
39
+ let errorMessage = getError("default");
40
+ if (item) {
41
+ const { name, type, size } = item;
42
+ const mime = validateFileMime(type, allowedMimetypes);
43
+ const ext = validateFileExtension(name, allowedExtensions);
44
+ const bytes = validateFileSize(size, maxBytes);
45
+ if (!mime) {
46
+ errorMessage = getError("duet-upload-101");
47
+ }
48
+ if (!ext) {
49
+ errorMessage = getError("duet-upload-100");
50
+ }
51
+ if (!bytes) {
52
+ errorMessage = getError("duet-upload-201");
53
+ }
54
+ valid = mime && ext && bytes;
55
+ }
56
+ else {
57
+ valid = false;
58
+ }
59
+ return {
60
+ valid,
61
+ errorMessage: valid ? undefined : getLocaleString(errorMessage.message),
62
+ errorSystem: valid ? undefined : errorMessage.system_message,
63
+ errorType: valid ? undefined : errorMessage.type,
64
+ };
65
+ };
66
+ export const validateTotalSizeIsAboveMax = (filelist, maxTotalBytes) => {
67
+ let total = 0;
68
+ if (maxTotalBytes) {
69
+ filelist.forEach(item => {
70
+ if (item.valid && item.size) {
71
+ total += item.size;
72
+ }
73
+ });
74
+ if (total < maxTotalBytes) {
75
+ return true;
76
+ }
77
+ }
78
+ return false;
79
+ };
80
+ export const validateTotalAmountIsAboveMax = (filelist, maxFiles) => {
81
+ let total = 0;
82
+ if (maxFiles) {
83
+ filelist.forEach(item => {
84
+ if (item.valid) {
85
+ total++;
86
+ }
87
+ });
88
+ if (total > maxFiles) {
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ };
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ export const formatBytes = (bytes, decimals = 2) => {
5
+ if (bytes === 0) {
6
+ return "0 Bytes";
7
+ }
8
+ const k = 1024;
9
+ const dm = decimals < 0 ? 0 : decimals;
10
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
11
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
12
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
13
+ };
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ export const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress }) => {
5
+ const { type = "POST", xhr, uri, argument = null, headers = null } = options;
6
+ xhr.open(type, `${uri}${argument || ""}`, true);
7
+ const { data, name } = payload;
8
+ // headers must be added after open
9
+ if (headers) {
10
+ Object.keys(headers).forEach(key => {
11
+ xhr.setRequestHeader(key, headers[key]);
12
+ });
13
+ }
14
+ if (type === "POST") {
15
+ xhr.onreadystatechange = () => {
16
+ // Call a function when the state changes.
17
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status < 300) {
18
+ // Request finished without errors
19
+ onSuccess(xhr, name, xhr.status);
20
+ }
21
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 300 && xhr.status < 999) {
22
+ // Request finished with errors
23
+ onFailure(xhr, name, xhr.status);
24
+ }
25
+ };
26
+ onProgress(name);
27
+ }
28
+ xhr.send(data);
29
+ return xhr;
30
+ };
@@ -0,0 +1,217 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ import { Component, h, Host, Prop, State, Watch } from "@stencil/core";
5
+ export class DuetUploadAriaStatus {
6
+ constructor() {
7
+ /**
8
+ * State() variables
9
+ */
10
+ this.statusMessage = null;
11
+ /**
12
+ * Status labels used in the component
13
+ */
14
+ this.statusMessageLabel = null;
15
+ /**
16
+ * Adds accessible label that is read aloud
17
+ */
18
+ this.accessibleAriaLive = "polite";
19
+ /**
20
+ * valid file amount
21
+ */
22
+ this.valid = undefined;
23
+ /**
24
+ * total files
25
+ */
26
+ this.total = undefined;
27
+ /**
28
+ * invalid file amount
29
+ */
30
+ this.invalid = undefined;
31
+ /**
32
+ * valid file amount
33
+ */
34
+ this.inprogress = undefined;
35
+ /**
36
+ * Private functions
37
+ */
38
+ this.replacePlaceHolders = (statusString) => {
39
+ const addFiles = (amount) => {
40
+ return amount > 1 ? `${amount} ${this.statusMessageLabel.files}` : `${amount} ${this.statusMessageLabel.file}`;
41
+ };
42
+ return statusString
43
+ .replace("{filesUploaded}", addFiles(this.valid))
44
+ .replace("{filesInProgress}", addFiles(this.inprogress))
45
+ .replace("{filesTotal}", addFiles(this.total))
46
+ .replace("{filesWithErrors}", addFiles(this.invalid));
47
+ };
48
+ this.getStatusMessage = () => {
49
+ const { done, inProgress, doneWithErrors, inProgressWithErrors } = this.statusMessageLabel;
50
+ const hasErrors = this.invalid > 0;
51
+ const isInProgress = this.inprogress > 0;
52
+ const isInProgressWithErrors = this.inprogress > 0 && hasErrors;
53
+ const isDone = this.valid === this.total && !isInProgress && !hasErrors;
54
+ const isDoneWithErrors = this.valid + this.invalid === this.total && !isInProgress;
55
+ if (isDone) {
56
+ this.statusMessage = this.replacePlaceHolders(done);
57
+ return;
58
+ }
59
+ else if (isInProgressWithErrors) {
60
+ this.statusMessage = this.replacePlaceHolders(inProgressWithErrors);
61
+ return;
62
+ }
63
+ else if (isInProgress) {
64
+ this.statusMessage = this.replacePlaceHolders(inProgress);
65
+ return;
66
+ }
67
+ else if (isDoneWithErrors) {
68
+ this.statusMessage = this.replacePlaceHolders(doneWithErrors);
69
+ return;
70
+ }
71
+ return;
72
+ };
73
+ }
74
+ watchHandler(newValue, oldValue) {
75
+ if (newValue !== oldValue) {
76
+ this.getStatusMessage();
77
+ }
78
+ }
79
+ /**
80
+ * render() function
81
+ * Always the last one in the class.
82
+ */
83
+ render() {
84
+ return (h(Host, { role: "status", "aria-live": "assertive", "aria-atomic": "true", "aria-relevant": "all" },
85
+ h("duet-visually-hidden", null, this.statusMessage)));
86
+ }
87
+ static get is() { return "duet-upload-aria-status"; }
88
+ static get encapsulation() { return "shadow"; }
89
+ static get properties() { return {
90
+ "statusMessageLabel": {
91
+ "type": "unknown",
92
+ "mutable": false,
93
+ "complexType": {
94
+ "original": "StatusMessage",
95
+ "resolved": "{ inProgress: string; inProgressWithErrors: string; done: string; doneWithErrors: string; file: string; files: string; }",
96
+ "references": {
97
+ "StatusMessage": {
98
+ "location": "local"
99
+ }
100
+ }
101
+ },
102
+ "required": false,
103
+ "optional": false,
104
+ "docs": {
105
+ "tags": [],
106
+ "text": "Status labels used in the component"
107
+ },
108
+ "defaultValue": "null"
109
+ },
110
+ "accessibleAriaLive": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "\"off\" | \"polite\" | \"assertive\"",
115
+ "resolved": "\"assertive\" | \"off\" | \"polite\"",
116
+ "references": {}
117
+ },
118
+ "required": false,
119
+ "optional": false,
120
+ "docs": {
121
+ "tags": [],
122
+ "text": "Adds accessible label that is read aloud"
123
+ },
124
+ "attribute": "accessible-aria-live",
125
+ "reflect": false,
126
+ "defaultValue": "\"polite\""
127
+ },
128
+ "valid": {
129
+ "type": "number",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "number",
133
+ "resolved": "number",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": "valid file amount"
141
+ },
142
+ "attribute": "valid",
143
+ "reflect": false,
144
+ "defaultValue": "undefined"
145
+ },
146
+ "total": {
147
+ "type": "number",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "number",
151
+ "resolved": "number",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": "total files"
159
+ },
160
+ "attribute": "total",
161
+ "reflect": false,
162
+ "defaultValue": "undefined"
163
+ },
164
+ "invalid": {
165
+ "type": "number",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "number",
169
+ "resolved": "number",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "invalid file amount"
177
+ },
178
+ "attribute": "invalid",
179
+ "reflect": false,
180
+ "defaultValue": "undefined"
181
+ },
182
+ "inprogress": {
183
+ "type": "number",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "number",
187
+ "resolved": "number",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "valid file amount"
195
+ },
196
+ "attribute": "inprogress",
197
+ "reflect": false,
198
+ "defaultValue": "undefined"
199
+ }
200
+ }; }
201
+ static get states() { return {
202
+ "statusMessage": {}
203
+ }; }
204
+ static get watchers() { return [{
205
+ "propName": "valid",
206
+ "methodName": "watchHandler"
207
+ }, {
208
+ "propName": "invalid",
209
+ "methodName": "watchHandler"
210
+ }, {
211
+ "propName": "inprogress",
212
+ "methodName": "watchHandler"
213
+ }, {
214
+ "propName": "total",
215
+ "methodName": "watchHandler"
216
+ }]; }
217
+ }
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ export const debounce = (func, timeout = 50) => {
5
+ let timer;
6
+ return (...args) => {
7
+ clearTimeout(timer);
8
+ timer = setTimeout(() => {
9
+ func.apply(this, args);
10
+ }, timeout);
11
+ };
12
+ };
@@ -54,14 +54,17 @@ export const getLocale = (lang) => {
54
54
  }
55
55
  throw new Error(`Locale for "${lang}" not found`);
56
56
  };
57
- const sanitizeString = (string) => {
57
+ /**
58
+ * Takes any json object that is passed and/or htmlencoded and converts it to proper json
59
+ */
60
+ export const sanitizeString = (string) => {
58
61
  const argIsString = typeof string === "string";
59
62
  if (argIsString) {
60
63
  try {
61
64
  return JSON.parse(convertHtmlQuotes(string));
62
65
  }
63
66
  catch (e) {
64
- console.log("getLocaleString received a string, that didnt parse to json object", string, e);
67
+ console.log("sanitizeString received a string, that didnt parse to json object", string, e);
65
68
  }
66
69
  }
67
70
  return string;
@@ -73,7 +76,7 @@ const sanitizeString = (string) => {
73
76
  * @param {object} langObject - {fi: "finnish", sv: "swedish", en: "english"} | string will get JSON.parsed
74
77
  * @param {boolean} languageOverride = false - in case you want to override the actual language set in html tag
75
78
  * @default {object} {locale: "fi-FI", money: "€"}
76
- * @returns {(string|Object)} given example contains {fi:"something"} and langua===fi this will return "something"
79
+ * @returns {(string|Object)} given example contains {fi:"something"} and language===fi this will return "something"
77
80
  */
78
81
  export const getLocaleString = (langObject, languageOverride) => {
79
82
  const obj = sanitizeString(langObject);
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ /**
5
+ * Produces a function which uses template strings to do simple interpolation from objects.
6
+ *
7
+ * Usage:
8
+ * var makeMeKing = generateTemplateFn('${name} is now the king of ${country}!');
9
+ *
10
+ * console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
11
+ * // Logs 'Bryan is now the king of Scotland!'
12
+ */
13
+ export const generateTemplateFn = (function () {
14
+ const cache = {};
15
+ function generateTemplate(template) {
16
+ if (typeof template !== "string") {
17
+ template = template.outerHTML;
18
+ }
19
+ let fn = cache[template];
20
+ if (!fn) {
21
+ // Replace ${expressions} (etc) with ${map.expressions}.
22
+ const sanitized = template
23
+ .replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
24
+ return `\$\{map.${match.trim()}\}`;
25
+ })
26
+ // Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
27
+ .replace(/(\$\{(?!map\.)[^}]+\})/g, "");
28
+ fn = Function("map", `return \`${sanitized}\``);
29
+ }
30
+ return fn;
31
+ }
32
+ return generateTemplate;
33
+ })();