@duetds/components 4.36.0 → 5.0.1

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 (324) hide show
  1. package/hydrate/index.js +1143 -983
  2. package/lib/cjs/duet-action-button.cjs.entry.js +163 -0
  3. package/lib/cjs/duet-alert.cjs.entry.js +1 -1
  4. package/lib/cjs/duet-badge.cjs.entry.js +1 -1
  5. package/lib/cjs/duet-breadcrumb.cjs.entry.js +1 -1
  6. package/lib/cjs/duet-breadcrumbs.cjs.entry.js +1 -1
  7. package/lib/cjs/duet-button_2.cjs.entry.js +8 -4
  8. package/lib/cjs/duet-caption_4.cjs.entry.js +3 -3
  9. package/lib/cjs/duet-card.cjs.entry.js +3 -3
  10. package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
  11. package/lib/cjs/duet-choice_2.cjs.entry.js +4 -4
  12. package/lib/cjs/duet-collapsible.cjs.entry.js +3 -3
  13. package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
  14. package/lib/cjs/duet-date-picker.cjs.entry.js +4 -4
  15. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
  16. package/lib/cjs/{duet-editable-table_4.cjs.entry.js → duet-editable-table_3.cjs.entry.js} +382 -337
  17. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
  18. package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
  19. package/lib/cjs/duet-footer.cjs.entry.js +1 -1
  20. package/lib/cjs/duet-grid_2.cjs.entry.js +2 -2
  21. package/lib/cjs/duet-header_2.cjs.entry.js +7 -7
  22. package/lib/cjs/duet-hero.cjs.entry.js +1 -1
  23. package/lib/cjs/duet-icon.cjs.entry.js +3 -3
  24. package/lib/cjs/duet-input_2.cjs.entry.js +1 -1
  25. package/lib/cjs/duet-layout.cjs.entry.js +1 -1
  26. package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
  27. package/lib/cjs/duet-modal.cjs.entry.js +2 -2
  28. package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
  29. package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
  30. package/lib/cjs/duet-pagination_2.cjs.entry.js +24 -14
  31. package/lib/cjs/duet-progress.cjs.entry.js +1 -1
  32. package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
  33. package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
  34. package/lib/cjs/duet-scrollable_3.cjs.entry.js +2 -2
  35. package/lib/cjs/duet-select.cjs.entry.js +1 -1
  36. package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
  37. package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
  38. package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
  39. package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
  40. package/lib/cjs/duet-tray.cjs.entry.js +2 -2
  41. package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
  42. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  43. package/lib/cjs/duet.cjs.js +2 -2
  44. package/lib/cjs/{focus-utils-675b1aa3.js → focus-utils-1051dbe3.js} +1 -1
  45. package/lib/cjs/{index-58eb8f67.js → index-db0781a3.js} +1 -1
  46. package/lib/cjs/js-utils-be1d29ae.js +39 -0
  47. package/lib/cjs/loader.cjs.js +2 -2
  48. package/lib/cjs/{token-utils-05bd23b4.js → token-utils-ac8432d1.js} +10 -7
  49. package/lib/cjs/{tokens-8596cece.js → tokens-72efc7fd.js} +0 -0
  50. package/lib/cjs/{tokens.module-6b2df1c2.js → tokens.module-6afcc9c1.js} +0 -0
  51. package/lib/collection/collection-manifest.json +14 -11
  52. package/lib/collection/components/duet-action-button/duet-action-button.css +87 -0
  53. package/lib/collection/components/duet-action-button/duet-action-button.js +489 -0
  54. package/lib/collection/components/duet-button/duet-button.js +23 -1
  55. package/lib/collection/components/duet-choice/duet-choice.css +20 -15
  56. package/lib/collection/components/duet-choice/duet-choice.js +10 -8
  57. package/lib/collection/components/duet-collapsible/duet-collapsible.js +2 -1
  58. package/lib/collection/components/duet-date-picker/duet-date-picker.css +2 -57
  59. package/lib/collection/components/duet-date-picker/duet-date-picker.js +2 -6
  60. package/lib/collection/components/duet-editable-table/duet-editable-table-tabledata.js +3 -2
  61. package/lib/collection/components/duet-editable-table/duet-editable-table.css +20 -1
  62. package/lib/collection/components/duet-editable-table/duet-editable-table.js +331 -205
  63. package/lib/collection/components/duet-header/duet-header.css +5 -1
  64. package/lib/collection/components/duet-header/duet-header.js +4 -3
  65. package/lib/collection/components/duet-pagination/duet-pagination.css +3 -62
  66. package/lib/collection/components/duet-pagination/duet-pagination.js +49 -19
  67. package/lib/collection/components/duet-range-stepper/duet-range-stepper.css +4 -55
  68. package/lib/collection/components/duet-range-stepper/duet-range-stepper.js +2 -4
  69. package/lib/collection/components/duet-tab-group/duet-tab-group.js +5 -1
  70. package/lib/collection/components/duet-table/duet-table.css +42 -8
  71. package/lib/collection/components/duet-table/duet-table.js +11 -2
  72. package/lib/collection/components/duet-upload/duet-upload.css +25 -0
  73. package/lib/collection/components/duet-upload/duet-upload.js +270 -166
  74. package/lib/collection/components/duet-upload/upload-validators.js +1 -1
  75. package/lib/collection/utils/fixture-utils.js +3 -1
  76. package/lib/collection/utils/js-utils.js +36 -1
  77. package/lib/collection/utils/token-utils.js +33 -6
  78. package/lib/custom-elements-bundle/index.d.ts +6 -12
  79. package/lib/custom-elements-bundle/index.js +1159 -1015
  80. package/lib/duet/duet.esm.js +1 -1
  81. package/lib/duet/duet.js +1 -1
  82. package/lib/duet/p-038f5a76.js +4 -0
  83. package/lib/duet/{p-aa5abb52.system.entry.js → p-077e9821.system.entry.js} +1 -1
  84. package/lib/duet/{p-9358e24b.entry.js → p-08f1713b.entry.js} +1 -1
  85. package/lib/duet/{p-6aa8d848.entry.js → p-0cf96c98.entry.js} +1 -1
  86. package/lib/duet/p-0ff56acb.system.entry.js +4 -0
  87. package/lib/duet/p-13302cc8.entry.js +4 -0
  88. package/lib/duet/{p-a0f979a4.entry.js → p-1630296b.entry.js} +1 -1
  89. package/lib/duet/{p-818cd527.entry.js → p-1acbc962.entry.js} +1 -1
  90. package/lib/duet/{p-1afe9641.system.entry.js → p-20dd2c3c.system.entry.js} +1 -1
  91. package/lib/duet/{p-85d9b1b0.system.js → p-21ab96c0.system.js} +1 -1
  92. package/lib/duet/{p-e67fc1ed.system.entry.js → p-222c74a9.system.entry.js} +1 -1
  93. package/lib/duet/{p-5e410fa9.system.entry.js → p-242ba82c.system.entry.js} +1 -1
  94. package/lib/duet/{p-40360b4a.system.entry.js → p-25fdd6d2.system.entry.js} +1 -1
  95. package/lib/duet/{p-ddb6344c.system.js → p-268c0abb.system.js} +0 -0
  96. package/lib/duet/{p-a2db8ff2.system.entry.js → p-26c5cc5a.system.entry.js} +1 -1
  97. package/lib/duet/{p-4b688aea.entry.js → p-2772bbb1.entry.js} +1 -1
  98. package/lib/duet/{p-bf25e52a.entry.js → p-28e4253c.entry.js} +1 -1
  99. package/lib/duet/{p-6df7b78c.entry.js → p-3018d431.entry.js} +1 -1
  100. package/lib/duet/{p-ad8a49a3.system.entry.js → p-347ffc22.system.entry.js} +1 -1
  101. package/lib/duet/{p-e9ca7e01.entry.js → p-3651b695.entry.js} +1 -1
  102. package/lib/duet/{p-4f32cc18.system.entry.js → p-3946058c.system.entry.js} +1 -1
  103. package/lib/duet/p-3d5a497d.system.entry.js +4 -0
  104. package/lib/duet/{p-8c0fd5de.js → p-3eed1432.js} +1 -1
  105. package/lib/duet/{p-44a3794d.system.entry.js → p-41246296.system.entry.js} +1 -1
  106. package/lib/duet/{p-314b64b4.system.entry.js → p-43204695.system.entry.js} +1 -1
  107. package/lib/duet/{p-daede773.entry.js → p-440a9c95.entry.js} +1 -1
  108. package/lib/duet/{p-8b8c2ef4.entry.js → p-44bb7ac8.entry.js} +1 -1
  109. package/lib/duet/{p-b42066e0.entry.js → p-489d1777.entry.js} +1 -1
  110. package/lib/duet/{p-2a9345a7.entry.js → p-48cdb48a.entry.js} +1 -1
  111. package/lib/duet/{p-e584ce1d.entry.js → p-4b72d87e.entry.js} +1 -1
  112. package/lib/duet/{p-99a112e4.entry.js → p-4be7b036.entry.js} +1 -1
  113. package/lib/duet/{p-ac44ab7a.entry.js → p-4d300ede.entry.js} +1 -1
  114. package/lib/duet/{p-8a768d0b.entry.js → p-569ee410.entry.js} +1 -1
  115. package/lib/duet/{p-84940fc4.system.entry.js → p-56f472b3.system.entry.js} +1 -1
  116. package/lib/duet/p-5746d88c.js +4 -0
  117. package/lib/duet/{p-90799d0a.entry.js → p-5a69aed5.entry.js} +1 -1
  118. package/lib/duet/{p-8db453bf.system.js → p-5cc4b13d.system.js} +1 -1
  119. package/lib/duet/{p-8706664b.system.entry.js → p-63b70e9d.system.entry.js} +1 -1
  120. package/lib/duet/p-63c8a2cd.system.entry.js +4 -0
  121. package/lib/duet/p-6abdc336.entry.js +4 -0
  122. package/lib/duet/p-6ba556ad.entry.js +4 -0
  123. package/lib/duet/{p-f993e4c3.system.entry.js → p-6c27e55c.system.entry.js} +1 -1
  124. package/lib/duet/{p-7730d2b8.entry.js → p-6d3485e0.entry.js} +1 -1
  125. package/lib/duet/{p-a75776f5.entry.js → p-6f2aec60.entry.js} +1 -1
  126. package/lib/duet/p-75640b15.entry.js +4 -0
  127. package/lib/duet/{p-21cd146b.system.entry.js → p-7769f3af.system.entry.js} +1 -1
  128. package/lib/duet/p-77acbfe4.system.js +4 -0
  129. package/lib/duet/{p-ad06c91d.system.entry.js → p-7a8cea36.system.entry.js} +1 -1
  130. package/lib/duet/{p-fa99eaa4.system.js → p-812b0905.system.js} +0 -0
  131. package/lib/duet/{p-ae82d8e7.entry.js → p-815e5588.entry.js} +1 -1
  132. package/lib/duet/p-823501e1.system.entry.js +4 -0
  133. package/lib/duet/p-8e83c0ea.system.entry.js +4 -0
  134. package/lib/duet/p-92639d0b.system.js +4 -0
  135. package/lib/duet/{p-22e6615d.system.entry.js → p-93302e3a.system.entry.js} +1 -1
  136. package/lib/duet/{p-6e6e1b77.system.entry.js → p-94bc746c.system.entry.js} +1 -1
  137. package/lib/duet/{p-09920da9.entry.js → p-9716f92a.entry.js} +1 -1
  138. package/lib/duet/{p-9ead1c59.entry.js → p-9a535dd9.entry.js} +1 -1
  139. package/lib/duet/{p-78779ba1.system.entry.js → p-9cf9c233.system.entry.js} +1 -1
  140. package/lib/duet/{p-c0a24b5e.system.entry.js → p-a853c03b.system.entry.js} +2 -2
  141. package/lib/duet/{p-ea124391.system.entry.js → p-ab651bab.system.entry.js} +1 -1
  142. package/lib/duet/{p-fb55e381.system.entry.js → p-b1d3ee06.system.entry.js} +1 -1
  143. package/lib/duet/p-b4a3ee75.entry.js +4 -0
  144. package/lib/duet/{p-b5aaf161.entry.js → p-b4eb216b.entry.js} +1 -1
  145. package/lib/duet/p-baf1b7ec.system.entry.js +4 -0
  146. package/lib/duet/{p-7f1cbb7d.entry.js → p-bfd81bd7.entry.js} +1 -1
  147. package/lib/duet/{p-80aa512a.system.entry.js → p-c0f57d75.system.entry.js} +1 -1
  148. package/lib/duet/{p-dda7f098.entry.js → p-c3342f8e.entry.js} +1 -1
  149. package/lib/duet/{p-aebf6700.entry.js → p-ca7fd033.entry.js} +1 -1
  150. package/lib/duet/{p-0769de2b.system.entry.js → p-cac113fe.system.entry.js} +1 -1
  151. package/lib/duet/p-cb701a9c.entry.js +4 -0
  152. package/lib/duet/{p-0349b691.system.entry.js → p-d214b9b2.system.entry.js} +1 -1
  153. package/lib/duet/{p-b11f2fcd.system.entry.js → p-d2b946cd.system.entry.js} +1 -1
  154. package/lib/duet/{p-5f4362b4.entry.js → p-d3169bff.entry.js} +1 -1
  155. package/lib/duet/{p-b6b58d31.entry.js → p-d57ac853.entry.js} +1 -1
  156. package/lib/duet/{p-59480299.system.entry.js → p-d7263055.system.entry.js} +1 -1
  157. package/lib/duet/{p-c167a5aa.system.entry.js → p-d7ad9b74.system.entry.js} +1 -1
  158. package/lib/duet/{p-8143f3de.js → p-d7bc0102.js} +0 -0
  159. package/lib/duet/{p-d444e178.system.entry.js → p-d81e9ca0.system.entry.js} +1 -1
  160. package/lib/duet/{p-878c1c83.system.entry.js → p-d8f83ac5.system.entry.js} +1 -1
  161. package/lib/duet/{p-84a9fbf4.system.entry.js → p-da76095f.system.entry.js} +1 -1
  162. package/lib/duet/p-dbb4a588.js +4 -0
  163. package/lib/duet/{p-a8f707d4.system.entry.js → p-e1920232.system.entry.js} +2 -2
  164. package/lib/duet/{p-1c1c9705.entry.js → p-e4c6b105.entry.js} +1 -1
  165. package/lib/duet/{p-663aec3a.entry.js → p-e5531f4f.entry.js} +1 -1
  166. package/lib/duet/p-ea293f60.entry.js +4 -0
  167. package/lib/duet/{p-95f71b43.system.entry.js → p-eb39b494.system.entry.js} +1 -1
  168. package/lib/duet/{p-ad07f399.js → p-ed75c8b3.js} +0 -0
  169. package/lib/duet/{p-fd561872.system.entry.js → p-f20b487a.system.entry.js} +1 -1
  170. package/lib/duet/{p-1aeb418c.entry.js → p-f7d7ec47.entry.js} +1 -1
  171. package/lib/duet/p-fa02e479.entry.js +4 -0
  172. package/lib/duet/p-faf60d2a.entry.js +4 -0
  173. package/lib/duet/{p-28a22555.system.entry.js → p-fb8ed18e.system.entry.js} +1 -1
  174. package/lib/duet/p-fea2cbc5.system.js +4 -0
  175. package/lib/duet/{p-c61ace58.system.entry.js → p-ff3d551a.system.entry.js} +1 -1
  176. package/lib/duet/{p-bd602c98.entry.js → p-ff7ab8cb.entry.js} +1 -1
  177. package/lib/esm/duet-action-button.entry.js +159 -0
  178. package/lib/esm/duet-alert.entry.js +1 -1
  179. package/lib/esm/duet-badge.entry.js +1 -1
  180. package/lib/esm/duet-breadcrumb.entry.js +1 -1
  181. package/lib/esm/duet-breadcrumbs.entry.js +1 -1
  182. package/lib/esm/duet-button_2.entry.js +8 -4
  183. package/lib/esm/duet-caption_4.entry.js +3 -3
  184. package/lib/esm/duet-card.entry.js +3 -3
  185. package/lib/esm/duet-checkbox.entry.js +1 -1
  186. package/lib/esm/duet-choice_2.entry.js +4 -4
  187. package/lib/esm/duet-collapsible.entry.js +3 -3
  188. package/lib/esm/duet-cookie-consent.entry.js +1 -1
  189. package/lib/esm/duet-date-picker.entry.js +4 -4
  190. package/lib/esm/duet-divider_2.entry.js +1 -1
  191. package/lib/esm/{duet-editable-table_4.entry.js → duet-editable-table_3.entry.js} +384 -338
  192. package/lib/esm/duet-empty-state.entry.js +1 -1
  193. package/lib/esm/duet-fieldset.entry.js +1 -1
  194. package/lib/esm/duet-footer.entry.js +1 -1
  195. package/lib/esm/duet-grid_2.entry.js +2 -2
  196. package/lib/esm/duet-header_2.entry.js +7 -7
  197. package/lib/esm/duet-hero.entry.js +1 -1
  198. package/lib/esm/duet-icon.entry.js +3 -3
  199. package/lib/esm/duet-input_2.entry.js +1 -1
  200. package/lib/esm/duet-layout.entry.js +1 -1
  201. package/lib/esm/duet-list_2.entry.js +1 -1
  202. package/lib/esm/duet-modal.entry.js +2 -2
  203. package/lib/esm/duet-notification_2.entry.js +1 -1
  204. package/lib/esm/duet-number-input.entry.js +1 -1
  205. package/lib/esm/duet-pagination_2.entry.js +24 -14
  206. package/lib/esm/duet-progress.entry.js +1 -1
  207. package/lib/esm/duet-radio_2.entry.js +1 -1
  208. package/lib/esm/duet-range-slider.entry.js +2 -2
  209. package/lib/esm/duet-scrollable_3.entry.js +2 -2
  210. package/lib/esm/duet-select.entry.js +1 -1
  211. package/lib/esm/duet-step_2.entry.js +1 -1
  212. package/lib/esm/duet-textarea.entry.js +1 -1
  213. package/lib/esm/duet-toggle.entry.js +1 -1
  214. package/lib/esm/duet-tooltip.entry.js +1 -1
  215. package/lib/esm/duet-tray.entry.js +2 -2
  216. package/lib/esm/duet-upload-aria-status.entry.js +1 -1
  217. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  218. package/lib/esm/duet.js +2 -2
  219. package/lib/esm/{focus-utils-bd3c1702.js → focus-utils-f49312fd.js} +1 -1
  220. package/lib/esm/{index-49b2d31a.js → index-9526901a.js} +1 -1
  221. package/lib/esm/js-utils-52e0944c.js +36 -0
  222. package/lib/esm/loader.js +2 -2
  223. package/lib/esm/{token-utils-75f78ca4.js → token-utils-e9a0cb88.js} +10 -7
  224. package/lib/esm/{tokens-e110dc89.js → tokens-57d98824.js} +0 -0
  225. package/lib/esm/{tokens.module-49cbf963.js → tokens.module-a13e9683.js} +0 -0
  226. package/lib/esm-es5/duet-action-button.entry.js +4 -0
  227. package/lib/esm-es5/duet-alert.entry.js +1 -1
  228. package/lib/esm-es5/duet-badge.entry.js +1 -1
  229. package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
  230. package/lib/esm-es5/duet-breadcrumbs.entry.js +1 -1
  231. package/lib/esm-es5/duet-button_2.entry.js +1 -1
  232. package/lib/esm-es5/duet-caption_4.entry.js +1 -1
  233. package/lib/esm-es5/duet-card.entry.js +1 -1
  234. package/lib/esm-es5/duet-checkbox.entry.js +1 -1
  235. package/lib/esm-es5/duet-choice_2.entry.js +1 -1
  236. package/lib/esm-es5/duet-collapsible.entry.js +1 -1
  237. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  238. package/lib/esm-es5/duet-date-picker.entry.js +2 -2
  239. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  240. package/lib/esm-es5/duet-editable-table_3.entry.js +4 -0
  241. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  242. package/lib/esm-es5/duet-fieldset.entry.js +1 -1
  243. package/lib/esm-es5/duet-footer.entry.js +1 -1
  244. package/lib/esm-es5/duet-grid_2.entry.js +1 -1
  245. package/lib/esm-es5/duet-header_2.entry.js +1 -1
  246. package/lib/esm-es5/duet-hero.entry.js +1 -1
  247. package/lib/esm-es5/duet-icon.entry.js +1 -1
  248. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  249. package/lib/esm-es5/duet-layout.entry.js +1 -1
  250. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  251. package/lib/esm-es5/duet-modal.entry.js +1 -1
  252. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  253. package/lib/esm-es5/duet-number-input.entry.js +1 -1
  254. package/lib/esm-es5/duet-pagination_2.entry.js +2 -2
  255. package/lib/esm-es5/duet-progress.entry.js +1 -1
  256. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  257. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  258. package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
  259. package/lib/esm-es5/duet-select.entry.js +1 -1
  260. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  261. package/lib/esm-es5/duet-textarea.entry.js +1 -1
  262. package/lib/esm-es5/duet-toggle.entry.js +1 -1
  263. package/lib/esm-es5/duet-tooltip.entry.js +1 -1
  264. package/lib/esm-es5/duet-tray.entry.js +1 -1
  265. package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
  266. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  267. package/lib/esm-es5/duet.js +1 -1
  268. package/lib/esm-es5/{focus-utils-bd3c1702.js → focus-utils-f49312fd.js} +1 -1
  269. package/lib/esm-es5/{index-49b2d31a.js → index-9526901a.js} +1 -1
  270. package/lib/esm-es5/js-utils-52e0944c.js +4 -0
  271. package/lib/esm-es5/loader.js +1 -1
  272. package/lib/esm-es5/token-utils-e9a0cb88.js +4 -0
  273. package/lib/esm-es5/{tokens-e110dc89.js → tokens-57d98824.js} +0 -0
  274. package/lib/esm-es5/{tokens.module-49cbf963.js → tokens.module-a13e9683.js} +0 -0
  275. package/lib/html.html-data.json +5266 -0
  276. package/lib/types/components/duet-action-button/duet-action-button.d.ts +112 -0
  277. package/lib/types/components/duet-button/duet-button.d.ts +4 -0
  278. package/lib/types/components/duet-collapsible/duet-collapsible.d.ts +1 -0
  279. package/lib/types/components/duet-editable-table/duet-editable-table-tabledata.d.ts +2 -2
  280. package/lib/types/components/duet-editable-table/duet-editable-table.d.ts +106 -48
  281. package/lib/types/components/duet-header/duet-header.d.ts +1 -0
  282. package/lib/types/components/duet-pagination/duet-pagination.d.ts +7 -2
  283. package/lib/types/components/duet-tab-group/duet-tab-group.d.ts +4 -0
  284. package/lib/types/components/duet-table/duet-table.d.ts +16 -0
  285. package/lib/types/components/duet-upload/duet-upload.d.ts +68 -58
  286. package/lib/types/components.d.ts +225 -149
  287. package/lib/types/utils/js-utils.d.ts +2 -0
  288. package/lib/types/utils/token-utils.d.ts +2 -0
  289. package/package.json +4 -5
  290. package/lib/cjs/duet-editable-table-button.cjs.entry.js +0 -96
  291. package/lib/cjs/js-utils-33a9dbe3.js +0 -16
  292. package/lib/collection/components/duet-editable-table/duet-editable-table-button.css +0 -32
  293. package/lib/collection/components/duet-editable-table/duet-editable-table-button.js +0 -225
  294. package/lib/collection/components/duet-editable-table/duet-editable-table-item.css +0 -36
  295. package/lib/collection/components/duet-editable-table/duet-editable-table-item.js +0 -225
  296. package/lib/duet/p-1b56e483.system.entry.js +0 -4
  297. package/lib/duet/p-298a9ffc.system.js +0 -4
  298. package/lib/duet/p-363abf26.system.entry.js +0 -4
  299. package/lib/duet/p-3c13a041.entry.js +0 -4
  300. package/lib/duet/p-50b4fb2c.js +0 -4
  301. package/lib/duet/p-6da8743f.system.entry.js +0 -4
  302. package/lib/duet/p-72ce134a.entry.js +0 -4
  303. package/lib/duet/p-78aa974b.system.entry.js +0 -4
  304. package/lib/duet/p-7e2c06d0.js +0 -4
  305. package/lib/duet/p-81867417.system.js +0 -4
  306. package/lib/duet/p-8f56fd3f.entry.js +0 -4
  307. package/lib/duet/p-8fa952df.entry.js +0 -4
  308. package/lib/duet/p-9782946f.entry.js +0 -4
  309. package/lib/duet/p-995f20fc.entry.js +0 -4
  310. package/lib/duet/p-a154a0c0.entry.js +0 -4
  311. package/lib/duet/p-a16a58c1.system.js +0 -4
  312. package/lib/duet/p-abcbdef5.entry.js +0 -4
  313. package/lib/duet/p-b25d3769.js +0 -4
  314. package/lib/duet/p-c5db93a7.system.entry.js +0 -4
  315. package/lib/duet/p-d32b240d.system.entry.js +0 -4
  316. package/lib/duet/p-fc02d8e9.entry.js +0 -4
  317. package/lib/esm/duet-editable-table-button.entry.js +0 -92
  318. package/lib/esm/js-utils-b69f17df.js +0 -14
  319. package/lib/esm-es5/duet-editable-table-button.entry.js +0 -4
  320. package/lib/esm-es5/duet-editable-table_4.entry.js +0 -4
  321. package/lib/esm-es5/js-utils-b69f17df.js +0 -4
  322. package/lib/esm-es5/token-utils-75f78ca4.js +0 -4
  323. package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +0 -73
  324. package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +0 -76
@@ -5,285 +5,228 @@
5
5
 
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
- const index = require('./index-58eb8f67.js');
9
- const jsUtils = require('./js-utils-33a9dbe3.js');
8
+ const index = require('./index-db0781a3.js');
9
+ const jsUtils = require('./js-utils-be1d29ae.js');
10
+ const keyboardUtils = require('./keyboard-utils-898cfe14.js');
10
11
  const languageUtils = require('./language-utils-aa282901.js');
11
12
  const themeableComponent = require('./themeable-component-0c1be552.js');
12
- const tokens_module = require('./tokens.module-6b2df1c2.js');
13
+ const tokens_module = require('./tokens.module-6afcc9c1.js');
13
14
  const createId = require('./create-id-c3b984b1.js');
14
15
  require('./string-utils-267e3dbb.js');
15
16
 
16
- /**
17
- * Produces a function which uses template strings to do simple interpolation from objects.
18
- *
19
- * Usage:
20
- * var makeMeKing = generateTemplateFn('${name} is now the king of ${country}!');
21
- *
22
- * console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
23
- * // Logs 'Bryan is now the king of Scotland!'
24
- */
25
- const generateTemplateFn = (function () {
26
- const cache = {};
27
- function generateTemplate(template) {
28
- if (typeof template !== "string") {
29
- template = template.outerHTML;
30
- }
31
- let fn = cache[template];
32
- if (!fn) {
33
- // Replace ${expressions} (etc) with ${map.expressions}.
34
- const sanitized = template
35
- .replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
36
- return `\$\{map.${match.trim()}\}`;
37
- })
38
- // Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
39
- .replace(/(\$\{(?!map\.)[^}]+\})/g, "");
40
- fn = Function("map", `return \`${sanitized}\``);
41
- }
42
- return fn;
17
+ //simple functional component that renders the data in the table
18
+ const TableData = ({ data, groupId, alignment }, _children) => {
19
+ const classNames = `duet-editable-table duet-editable-table-content-${groupId}`;
20
+ if (typeof data === "string") {
21
+ return index.h("td", { innerHTML: data, class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } });
43
22
  }
44
- return generateTemplate;
45
- })();
23
+ else {
24
+ return (index.h("td", { class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } }, data));
25
+ }
26
+ };
46
27
 
47
- const duetEditableTableCss = "duet-editable-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-header tr .duet-editable-table-header-hidden{padding:0 !important;font-size:0;border-bottom:0}";
28
+ const duetEditableTableCss = ".sc-duet-editable-table-h{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-actions-menu.sc-duet-editable-table{position:relative;padding:0 !important;margin:0}.duet-editable-table-actions-menu-button.sc-duet-editable-table{position:relative;right:-16px;float:right;padding:0}.duet-editable-table-actions-menu-icon.sc-duet-editable-table .duet-icon.sc-duet-editable-table{max-width:16px;max-height:16px}.duet-editable-table-row.duet-table-action-row.sc-duet-editable-table .duet-text-right.sc-duet-editable-table{text-align:right}.duet-editable-table-header.sc-duet-editable-table tr.sc-duet-editable-table .duet-editable-table-header-hidden.sc-duet-editable-table{padding:0 !important;font-size:0;border-bottom:0}";
48
29
 
49
30
  let DuetEditableTable = class {
50
31
  constructor(hostRef) {
51
32
  index.registerInstance(this, hostRef);
52
- this.template = undefined;
33
+ this.duetTableToggle = index.createEvent(this, "duetTableToggle", 7);
34
+ this.duetMenuClick = index.createEvent(this, "duetMenuClick", 7);
53
35
  /**
54
- * State() variables
55
- * @internal
36
+ * Duet-table: margin of the component.
56
37
  */
57
- this.tick = Date.now();
38
+ this.margin = "auto";
58
39
  /**
59
- * Map of items that contain list of things.
40
+ * Duet-table: Style variation of the table.
60
41
  */
61
- this.items = new Map();
42
+ this.variation = "striped";
62
43
  /**
63
- * Key used to set vertical alignment of action buttons
44
+ * Duet-table: Controls whether the table has a sticky header.
45
+ * Sticky headers are not compatible with breakpoint="none-scrollable".
64
46
  */
65
- this.alignment = "middle";
47
+ this.sticky = false;
66
48
  /**
67
- * Array of internationalized defaults for the default groups labels.
49
+ * Duet-table: Adjust the distance from top of the viewport (in pixels) when the
50
+ * table header becomes sticky.
68
51
  */
69
- this.groupsLabelDefaults = {
70
- fi: "Kaikki",
71
- en: "All items",
72
- sv: "Alla objekt",
73
- };
52
+ this.stickyDistance = "with-links";
53
+ /**
54
+ * Duet-table: By default the table is responsive - it will be flattened at narrow viewport widths.
55
+ * This prop controls the breakpoint at which the table should be rendered as a _regular_ table.
56
+ * Set to "none" to disable the responsive functionality.
57
+ * Set to "none-scrollable" to disable responsive functionality _and_ allow horizontal scrolling -
58
+ * this is useful for comparison tables where it's important to maintain column and row layout.
59
+ */
60
+ this.breakpoint = "small";
74
61
  /**
75
- * Array of internationalized defaults for the default action labels.
62
+ * Define actions for all items in a table
63
+ * An alternative to inline HTML table.
64
+ * required for Sortable tables
65
+ * @default undefined
76
66
  */
77
- this.actionLabelDefaults = {
78
- fi: "Toiminnot",
79
- en: "Actions",
80
- sv: "Handlingar",
81
- };
67
+ this.actions = undefined;
82
68
  /**
83
- * Array of group names that you want the editable table to display (can be used to hide or show groups depending on conditions).
84
- * @default { id: "all", label: this.groupsLabelDefaults, actionLabel: this.actionLabelDefaults }.
85
- * @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}].
69
+ * Define columns for a table
70
+ * An alternative to inline HTML table.
71
+ * required for Sortable tables
72
+ * @default undefined
86
73
  */
87
- this.groups = [
88
- { id: "all", label: this.groupsLabelDefaults, actionLabel: this.actionLabelDefaults },
89
- ];
74
+ this.columns = undefined;
90
75
  /**
91
- * Array of actions that are mapped via the map variable to the various groups defined in group.
76
+ * Define rows for a table
77
+ * An alternative to inline HTML table.
78
+ * required for Sortable tables
92
79
  * @default undefined
93
- * @example [{
94
- variation: "default",
95
- icon: "action-edit-2",
96
- id: "edit",
97
- map: ["success"],
98
- label: {
99
- fi: " Label",
100
- en: " Label",
101
- sv: " Label",
102
- }
103
- }]
104
80
  */
105
- this.actions = undefined;
81
+ this.rows = undefined;
106
82
  /**
107
- * Shows or hides the table labels.
83
+ * Controls whether the table is sortable by headers
108
84
  */
109
- this.hideGroups = false;
85
+ this.sortable = false;
110
86
  /**
111
- * Exposes the aria role for optimizing accessibility.
87
+ * Optional id that get passed to the table and used to setup ::parts
112
88
  */
113
- this.accessibleRole = undefined;
89
+ this.groupId = "";
114
90
  /**
115
91
  * Theme of the table.
116
92
  */
117
93
  this.theme = "";
118
94
  /**
119
- * Private methods.
95
+ * Exposes the aria role for optimizing accessibility.
120
96
  */
121
- this.kick = jsUtils.debounce(() => {
122
- this.tick = Date.now();
123
- }, 100); // will trigger re-render
97
+ this.accessibleRole = undefined;
98
+ this.sortableDefaultLabel = {
99
+ fi: "Järjestä",
100
+ en: "Click to sort",
101
+ sv: "Klicka för att sortera",
102
+ };
103
+ this.actionColumnLabel = {
104
+ en: "Actions for rows",
105
+ fi: "Toiminnot rivillä",
106
+ sv: "Åtgärder för rader",
107
+ };
124
108
  /**
125
- * If a user defines a template section within editable table, try to read an use it.
109
+ * Private methods.
126
110
  */
127
- this.getTemplate = () => {
128
- const templateDom = this.element.getElementsByTagName("template");
129
- if (templateDom === null || templateDom === void 0 ? void 0 : templateDom.length) {
130
- const templateString = templateDom[0].content.firstElementChild.outerHTML;
131
- return generateTemplateFn(templateString);
132
- }
133
- else {
134
- return false;
135
- }
136
- };
137
- this.getItemData = (data) => {
138
- const { item, group, uid } = data;
139
- if (this.template) {
140
- return {
141
- group,
142
- uid,
143
- item: this.template(item),
144
- };
145
- }
146
- return { item, group, uid };
111
+ this.toggleColumn = (column, e) => {
112
+ e.preventDefault();
113
+ const { sort_order, direction, index, key } = column;
114
+ this.duetTableToggle.emit({
115
+ sort_order,
116
+ index,
117
+ direction,
118
+ key,
119
+ component: "duet-editable-table",
120
+ originalEvent: e,
121
+ });
147
122
  };
148
- this.filterMap = needle => {
149
- if (needle === "all") {
150
- return Array.from(this.items);
123
+ this.handleKeyDown = (column, e) => {
124
+ if (keyboardUtils.isKeyboardClick(e)) {
125
+ this.toggleColumn(column, e);
151
126
  }
152
- return Array.from(this.items).filter(item => needle === item[1].group);
153
127
  };
154
128
  }
155
129
  /**
156
130
  * Component lifecycle events.
157
131
  */
158
132
  componentWillLoad() {
159
- // look for a <template> region in the duet-editable-table
160
- this.template = this.getTemplate();
161
- // take care of the case where groups and actions are defined as html properties instead of javascript objects
162
- if (typeof this.groups === "string") {
163
- this.internalGroupArray = languageUtils.sanitizeString(this.groups);
164
- }
165
- else {
166
- this.internalGroupArray = this.groups;
167
- }
168
- if (typeof this.actions === "string") {
169
- this.internalActionsArray = languageUtils.sanitizeString(this.actions);
170
- }
171
- else {
172
- this.internalActionsArray = this.actions;
173
- }
174
133
  themeableComponent.inheritGlobalTheme(this);
175
134
  }
176
- /**
177
- * Method to force an update of a tabular data array.
178
- * when called the method will rerender the entire tabular structure.
179
- */
180
- async updateTable(passedItems = undefined) {
181
- this.items = new Map(passedItems || this.items);
182
- this.kick();
183
- }
184
- render() {
185
- return (index.h(index.Host, { class: {
186
- "duet-theme-turva": this.theme === "turva",
187
- } }, this.internalGroupArray.map(group => {
188
- const currentGroup = this.filterMap(group.id);
189
- if (!currentGroup.length) {
190
- return;
135
+ createLabel(column) {
136
+ const { sort_order, direction, index: index$1, label } = column;
137
+ const i18nLabel = languageUtils.getLocaleString(label);
138
+ if (!this.sortable) {
139
+ return i18nLabel;
140
+ }
141
+ const getButtonIcon = () => {
142
+ // "action-subtract-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-subtract-small.svg
143
+ // "action-arrow-down-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-down-small.svg
144
+ // "action-arrow-up-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-up-small.svg
145
+ if (!!sort_order && direction === 1) {
146
+ return "action-arrow-down-small";
191
147
  }
192
- return (index.h("duet-table", { variation: "plain", breakpoint: "none", role: "", margin: this.hideGroups ? "none" : "auto" }, index.h("table", { class: "duet-editable-table", "aria-role": this.accessibleRole }, index.h("thead", { class: "duet-editable-table-header" }, index.h("tr", null, index.h("th", { class: {
193
- "duet-editable-table-header-hidden": this.hideGroups,
194
- } }, !this.hideGroups ? (languageUtils.getLocaleString(group.label)) : (index.h("duet-visually-hidden", null, languageUtils.getLocaleString(group.label)))), index.h("th", { class: {
195
- "duet-editable-table-header-hidden": this.hideGroups,
196
- } }, index.h("duet-visually-hidden", null, group.actionLabel
197
- ? languageUtils.getLocaleString(group.actionLabel)
198
- : languageUtils.getLocaleString(this.actionLabelDefaults))))), index.h("tbody", null, currentGroup.map(dataAsArray => {
199
- const [key, value] = dataAsArray;
200
- return (index.h("duet-editable-table-item", { theme: this.theme, keyName: key, data: this.getItemData(value), groupId: group.id, part: group.id, alignment: this.alignment, actions: this.internalActionsArray }));
201
- })))));
202
- })));
148
+ else if (!!sort_order && direction === -1) {
149
+ return "action-arrow-up-small";
150
+ }
151
+ return "action-subtract-small";
152
+ };
153
+ return (index.h("span", { class: "duet-table-label", "data-index": index$1 }, index.h("duet-button", { size: "small", icon: getButtonIcon(), "icon-size": "medium-small", "accessible-label": languageUtils.getLocaleString(this.sortableDefaultLabel), variation: "plain", margin: "none", "icon-right": true, onClick: event => this.toggleColumn(column, event), onKeyDown: event => this.handleKeyDown(column, event) }, i18nLabel)));
203
154
  }
204
- get element() { return index.getElement(this); }
205
- };
206
- DuetEditableTable.style = duetEditableTableCss;
207
-
208
- //simple functional component that renders the data in the table
209
- const TableData = ({ data, groupId, alignment }, _children) => {
210
- if (typeof data === "string") {
211
- return (index.h("td", { innerHTML: data, class: "duet-editable-table-content", part: `${groupId}content`, style: { verticalAlign: alignment } }));
155
+ getSortedColumns() {
156
+ //create a new array from sort instead of mutating original
157
+ return [...this.columns].sort(jsUtils.fieldSorter(["index"]));
212
158
  }
213
- else {
214
- return (index.h("td", { class: "duet-editable-table-content", part: `${groupId}content`, style: { verticalAlign: alignment } }, data));
159
+ getRowSortOrder() {
160
+ //create a new array from sort instead of mutating original
161
+ const fields = [...this.columns].sort(jsUtils.fieldSorter(["sort_order"]));
162
+ //return only key from objects that have sort_order
163
+ return fields
164
+ .filter(column => column.sort_order)
165
+ .map(column => {
166
+ // add - in-front of descending direction (required by field-sorter)
167
+ return column.direction === -1 ? `-${column.key}` : column.key;
168
+ });
215
169
  }
216
- };
217
-
218
- const duetEditableTableItemCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{display:table-row;height:32px}.duet-editable-table-content,.duet-editable-table-actions{height:32px;padding:12px 0;vertical-align:middle;break-word:break-all;border-bottom:1px solid #e1e3e6}.duet-editable-table-actions-items{display:flex;justify-content:flex-end}.duet-editable-table-actions-items duet-editable-table-button{padding-left:8px}.duet-editable-table .editable-item-small{font-size:0.75rem;font-weight:400}";
219
-
220
- let DuetEditableTableItem = class {
221
- constructor(hostRef) {
222
- index.registerInstance(this, hostRef);
223
- this.duetEditableItemAction = index.createEvent(this, "duetEditableItemAction", 7);
224
- this.isHovering = false;
225
- /**
226
- * Theme of the empty state component.
227
- */
228
- this.theme = "";
229
- /**
230
- * Actions that can be performed on the element
231
- */
232
- this.actions = undefined;
233
- /**
234
- * GroupId used to pierce the shadowdom - gets concatenated with "content & actions" and used as part="groupIDcontent/actions" to pierce the content/Action item
235
- * @internal
236
- */
237
- this.groupId = "";
238
- /**
239
- * Key used to set vertical alignment of action buttons
240
- */
241
- this.alignment = "middle";
242
- /**
243
- * Key used to identify item, when running actions
244
- */
245
- this.keyName = "";
246
- /**
247
- * Object of data itemsused to render the entire row
248
- */
249
- this.data = undefined;
170
+ renderTableHeader() {
171
+ if (!this.columns) {
172
+ return;
173
+ }
174
+ const sortedColumns = this.getSortedColumns();
175
+ return (index.h("tr", { class: {
176
+ "duet-table-action-header": !!this.actions,
177
+ } }, sortedColumns.map(column => {
178
+ if (column.display !== false) {
179
+ return index.h("th", { scope: "col" }, this.createLabel(column));
180
+ }
181
+ }), this.actions && (index.h("th", { scope: "col", class: "duet-table-action-header-heading" }, this.actions && index.h("duet-visually-hidden", null, languageUtils.getLocaleString(this.actionColumnLabel))))));
250
182
  }
251
- watchPropHandler(_newValue, _oldValue) {
252
- // console.log("The new value of activated is: ", _newValue)
183
+ renderActions(rowItem, index$1) {
184
+ // escape early
185
+ if (!this.actions) {
186
+ return;
187
+ }
188
+ // iterate through actions and add them in the sidebar
189
+ return (index.h("td", { class: "duet-text-right" }, this.actions.map(actionItem => {
190
+ return (index.h("duet-action-button", { actionMeta: Object.assign({}, (rowItem === null || rowItem === void 0 ? void 0 : rowItem.meta) || {}, { index: index$1 }), actionId: (rowItem === null || rowItem === void 0 ? void 0 : rowItem.uid) || (rowItem === null || rowItem === void 0 ? void 0 : rowItem.id) || null, actionName: actionItem.name, theme: this.theme, iconName: actionItem.icon, iconColor: actionItem.color, iconSize: actionItem.size, background: actionItem.background }));
191
+ })));
253
192
  }
254
- /**
255
- /**
256
- * Component lifecycle events.
257
- */
258
- componentWillLoad() {
259
- themeableComponent.inheritGlobalTheme(this);
193
+ renderTableBody() {
194
+ const columns = this.getSortedColumns();
195
+ const rowSortOrder = this.getRowSortOrder();
196
+ const sortedRows = [...this.rows].sort(jsUtils.fieldSorter(rowSortOrder));
197
+ // return a tbody with rows for each item in sortedRows
198
+ return sortedRows.map((row, index$1) => (index.h("tr", { class: {
199
+ "duet-table-action-row": !!this.actions,
200
+ "duet-editable-table-row": true,
201
+ [`duet-editable-table-row-${this.groupId}`]: true,
202
+ }, "data-meta": JSON.stringify(row.meta) }, columns.map(column => {
203
+ //if we don't have any data for this column, try getting an item instead (for backwards compatibility
204
+ const value = row[column.key] ? row[column.key] : row.item;
205
+ if (column.display !== false) {
206
+ return index.h(TableData, { data: value, groupId: this.groupId });
207
+ }
208
+ }), this.actions && this.renderActions(row, index$1))));
260
209
  }
261
210
  /**
262
- /**
263
- * private functions
264
- */
265
- /**
266
- * render() function
267
- * Always the last one in the class.
211
+ * Render Methods
268
212
  */
269
213
  render() {
270
- return (index.h(index.Host, { role: "row" }, index.h(TableData, { data: this.data.item, alignment: this.alignment, groupId: this.groupId }), index.h("td", { class: "duet-editable-table-actions", style: { verticalAlign: this.alignment } }, index.h("div", { class: "duet-editable-table-actions-items", part: `${this.groupId}actions` }, this.actions.map(result => {
271
- const { map = undefined } = result;
272
- // if map has been specified, only show the current action if groupID matches the map array
273
- if (map && !map.includes(this.groupId)) {
274
- return;
275
- }
276
- return (index.h("duet-editable-table-button", { keyName: this.keyName, group: this.data.group, uid: this.data.uid, actions: result, theme: this.theme }));
277
- })))));
214
+ return (index.h(index.Host, { class: {
215
+ [`duet-editable-table-${this.variation}`]: true,
216
+ [`duet-editable-table-${this.theme}`]: true,
217
+ // sticky only valid when in regular table layout
218
+ "duet-editable-table-scrollable": this.breakpoint === "none-scrollable",
219
+ "duet-editable-table-sortable": this.sortable,
220
+ "duet-editable-table-actions": !!this.actions,
221
+ "duet-m-0": this.margin === "none",
222
+ "duet-theme-turva": this.theme === "turva",
223
+ } }, index.h("duet-table", { sticky: this.sticky, stickyDistance: this.stickyDistance, margin: this.margin, theme: this.theme, variation: this.variation, breakpoint: this.breakpoint }, index.h("table", { role: this.accessibleRole }, index.h("caption", null, index.h("slot", { name: "tcaption" })), index.h("thead", null, index.h("tr", null, index.h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, index.h("slot", { name: "thead-first" }))), this.renderTableHeader(), index.h("tr", null, index.h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, index.h("slot", { name: "thead-last" })))), index.h("tbody", null, this.renderTableBody()), index.h("tfoot", null, index.h("tr", null, index.h("th", { class: "duet-editable-table-footer-menu", colSpan: 99 }, index.h("slot", { name: "tfoot" }))))))));
278
224
  }
279
- get el() { return index.getElement(this); }
280
- static get watchers() { return {
281
- "data": ["watchPropHandler"]
282
- }; }
225
+ get element() { return index.getElement(this); }
283
226
  };
284
- DuetEditableTableItem.style = duetEditableTableItemCss;
227
+ DuetEditableTable.style = duetEditableTableCss;
285
228
 
286
- const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}.duet-table-flattened table,.duet-table-flattened thead,.duet-table-flattened tbody,.duet-table-flattened tfoot,.duet-table-flattened th,.duet-table-flattened td,.duet-table-flattened tr{display:block}.duet-table-flattened thead tr{position:absolute !important;top:0;width:1px !important;height:1px !important;padding:0 !important;overflow:hidden !important;clip:rect(1px, 1px, 1px, 1px) !important;border:0 !important}.duet-table-flattened td{line-height:1.25}.duet-table-flattened td:not(:last-child){margin-bottom:16px !important}.duet-table-flattened tbody td,.duet-table-flattened tbody th,.duet-table-flattened tfoot td{padding:0 !important;text-align:left !important}.duet-table-flattened tbody th{font-weight:600;line-height:1.25;color:#657787;text-align:left}.duet-table-flattened td[data-heading]::before{margin-bottom:4px !important;display:block;font-size:1rem;font-weight:600;color:#00294d;content:attr(data-heading)}.duet-table-flattened.duet-theme-turva td[data-heading]::before{color:#171c3a}.duet-table-sticky thead th{position:sticky;top:0;background:white}.duet-table-striped td,.duet-table-striped th{padding:20px !important}@media (max-width: 35.9375em){.duet-table-striped td,.duet-table-striped th{padding:20px 12px !important}}.duet-table-striped tbody th{background:white}.duet-table-striped.duet-table-sticky thead th{border-bottom:1px solid #e1e3e6}.duet-table-striped.duet-table-sticky.duet-theme-turva thead th{border-bottom-color:#e4e4e6}.duet-table-striped tbody:not(:first-of-type) th{padding-top:40px !important}.duet-table-striped tbody:only-of-type tr:nth-of-type(odd){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:only-of-type tr:nth-of-type(odd){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tfoot td{border-top:1px solid #e1e3e6}.duet-table-striped.duet-theme-turva tfoot td{border-top-color:#e4e4e6}.duet-table-striped.duet-table-flattened tbody:not(:first-of-type) th{padding-top:20px !important}.duet-table-striped.duet-table-flattened tr{padding:20px !important}.duet-table-striped.duet-table-flattened tfoot td{border-top:0}.duet-table-striped.duet-table-flattened tfoot tr{border-top:1px solid #e1e3e6}.duet-table-striped.duet-table-flattened.duet-theme-turva tfoot tr{border-top-color:#e4e4e6}.duet-table-fixed th,.duet-table-minimal th,.duet-table-plain th{padding:16px !important;border-bottom:1px solid #657787}.duet-table-fixed th:first-child,.duet-table-minimal th:first-child,.duet-table-plain th:first-child{padding-left:0 !important}.duet-table-fixed th:last-child,.duet-table-minimal th:last-child,.duet-table-plain th:last-child{padding-right:0 !important}.duet-theme-turva.duet-table-fixed th,.duet-theme-turva.duet-table-minimal th,.duet-theme-turva.duet-table-plain th{border-bottom-color:#444445}.duet-table-fixed tbody th,.duet-table-minimal tbody th,.duet-table-plain tbody th{padding-top:40px !important;border-bottom-color:#e1e3e6}.duet-theme-turva.duet-table-fixed tbody th,.duet-theme-turva.duet-table-minimal tbody th,.duet-theme-turva.duet-table-plain tbody th{border-bottom-color:#e4e4e6}.duet-table-fixed td,.duet-table-minimal td,.duet-table-plain td{padding:16px !important}.duet-table-fixed td:first-child,.duet-table-minimal td:first-child,.duet-table-plain td:first-child{padding-left:0 !important}.duet-table-fixed td:last-child,.duet-table-minimal td:last-child,.duet-table-plain td:last-child{padding-right:0 !important}.duet-table-fixed tbody td,.duet-table-minimal tbody td,.duet-table-plain tbody td{border-bottom:1px solid #e1e3e6}.duet-theme-turva.duet-table-fixed tbody td,.duet-theme-turva.duet-table-minimal tbody td,.duet-theme-turva.duet-table-plain tbody td{border-bottom-color:#e4e4e6}.duet-table-flattened.duet-table-fixed tbody:first-of-type th,.duet-table-flattened.duet-table-minimal tbody:first-of-type th,.duet-table-flattened.duet-table-plain tbody:first-of-type th{padding-top:0 !important}.duet-table-flattened.duet-table-fixed td,.duet-table-flattened.duet-table-minimal td,.duet-table-flattened.duet-table-plain td,.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{border-bottom:0}.duet-table-flattened.duet-table-fixed tr,.duet-table-flattened.duet-table-minimal tr,.duet-table-flattened.duet-table-plain tr{padding:20px 0 !important}.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{padding-top:20px !important}.duet-table-flattened.duet-table-fixed tfoot td,.duet-table-flattened.duet-table-minimal tfoot td,.duet-table-flattened.duet-table-plain tfoot td{margin-bottom:4px !important}.duet-table-flattened.duet-table-fixed tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child{border-bottom:0}.duet-table-plain.duet-table-flattened tbody tr{border-bottom:1px solid #e1e3e6}.duet-table-plain.duet-table-flattened.duet-theme-turva tbody tr{border-bottom-color:#e4e4e6}.duet-table-minimal tbody tr,.duet-table-minimal tbody tr td{vertical-align:top;border-bottom:0 none}.duet-table-minimal tbody tr:last-of-type,.duet-table-minimal tbody tr:last-of-type td{border-bottom:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened tbody tr,.duet-table-minimal.duet-table-flattened tbody tr td{border-bottom:0 none}.duet-table-minimal.duet-table-flattened tbody tr td[data-heading]::before{display:none}.duet-table-minimal.duet-table-flattened tfoot{border-top:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened.duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-fixed table{table-layout:fixed}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td,.duet-table-fixed tbody tr td:first-child{padding:4px !important;vertical-align:text-bottom;border-bottom:0 none}.duet-table-fixed thead{display:none}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td{border-bottom:0 none}.duet-table-fixed:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-fixed:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-scrollable{position:relative;width:100%;overflow-x:auto;background:linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0)), linear-gradient(-90deg, #fff 0%, rgba(255, 255, 255, 0)) 100% 0, radial-gradient(farthest-side at 0% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) 100% 0%;background-repeat:no-repeat;background-attachment:local, local, scroll, scroll;background-size:100px 100%, 100px 100%, 12px 100%, 12px 100%}.duet-table-selected-column{background:rgba(0, 119, 179, 0.08)}.duet-theme-turva .duet-table-selected-column{background:rgba(68, 68, 69, 0.08)}";
229
+ const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}duet-table .duet-table-action-row td:last-child{justify-self:end;padding-right:20px !important;white-space:nowrap}.duet-table-flattened tbody tr{display:grid;grid-template-columns:repeat(2, 1fr);grid-auto-rows:auto;gap:10px}.duet-table-flattened tbody tr.duet-table-action-row td:last-child::before{padding:0;content:\"\"}.duet-table-flattened thead tr{position:absolute !important;top:0;width:1px !important;height:1px !important;padding:0 !important;overflow:hidden !important;clip:rect(1px, 1px, 1px, 1px) !important;border:0 !important}.duet-table-flattened td{grid-column:1/2;line-height:1.25}.duet-table-flattened td:not(:last-child){margin-bottom:16px !important}.duet-table-flattened td:first-child{grid-row:1;grid-column:1}.duet-table-flattened td:last-child{grid-row:1;grid-column:2}.duet-table-flattened tbody td,.duet-table-flattened tbody th,.duet-table-flattened tfoot td{padding:0 !important;text-align:left !important}.duet-table-flattened tbody th{font-weight:600;line-height:1.25;color:#657787;text-align:left}.duet-table-flattened td[data-heading]::before{margin-bottom:4px !important;display:block;font-size:1rem;font-weight:600;color:#00294d;content:attr(data-heading)}.duet-table-flattened.duet-theme-turva td[data-heading]::before{color:#171c3a}.duet-table-sticky thead th{position:sticky;top:0;background:white}.duet-table-striped td,.duet-table-striped th{padding:20px !important}@media (max-width: 35.9375em){.duet-table-striped td,.duet-table-striped th{padding:20px 12px !important}}.duet-table-striped tbody th{background:white}.duet-table-striped.duet-table-sticky thead th{border-bottom:1px solid #e1e3e6}.duet-table-striped.duet-table-sticky.duet-theme-turva thead th{border-bottom-color:#e4e4e6}.duet-table-striped tbody:not(:first-of-type) th{padding-top:40px !important}.duet-table-striped tbody:only-of-type tr:nth-of-type(odd){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:only-of-type tr:nth-of-type(odd){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tfoot td{border-top:1px solid #e1e3e6}.duet-table-striped.duet-theme-turva tfoot td{border-top-color:#e4e4e6}.duet-table-striped.duet-table-flattened tbody:not(:first-of-type) th{padding-top:20px !important}.duet-table-striped.duet-table-flattened tr{padding:20px !important}.duet-table-striped.duet-table-flattened tfoot td{border-top:0}.duet-table-striped.duet-table-flattened tfoot tr{border-top:1px solid #e1e3e6}.duet-table-striped.duet-table-flattened.duet-theme-turva tfoot tr{border-top-color:#e4e4e6}.duet-table-fixed th,.duet-table-minimal th,.duet-table-plain th{padding:16px !important;border-bottom:1px solid #657787}.duet-table-fixed th:first-child,.duet-table-minimal th:first-child,.duet-table-plain th:first-child{padding-left:0 !important}.duet-table-fixed th:last-child,.duet-table-minimal th:last-child,.duet-table-plain th:last-child{padding-right:0 !important}.duet-theme-turva.duet-table-fixed th,.duet-theme-turva.duet-table-minimal th,.duet-theme-turva.duet-table-plain th{border-bottom-color:#444445}.duet-table-fixed tbody th,.duet-table-minimal tbody th,.duet-table-plain tbody th{padding-top:40px !important;border-bottom-color:#e1e3e6}.duet-theme-turva.duet-table-fixed tbody th,.duet-theme-turva.duet-table-minimal tbody th,.duet-theme-turva.duet-table-plain tbody th{border-bottom-color:#e4e4e6}.duet-table-fixed td,.duet-table-minimal td,.duet-table-plain td{padding:16px !important}.duet-table-fixed td:first-child,.duet-table-minimal td:first-child,.duet-table-plain td:first-child{padding-left:0 !important}.duet-table-fixed td:last-child,.duet-table-minimal td:last-child,.duet-table-plain td:last-child{padding-right:0 !important}.duet-table-fixed tbody td,.duet-table-minimal tbody td,.duet-table-plain tbody td{border-bottom:1px solid #e1e3e6}.duet-theme-turva.duet-table-fixed tbody td,.duet-theme-turva.duet-table-minimal tbody td,.duet-theme-turva.duet-table-plain tbody td{border-bottom-color:#e4e4e6}.duet-table-flattened.duet-table-fixed tbody:first-of-type th,.duet-table-flattened.duet-table-minimal tbody:first-of-type th,.duet-table-flattened.duet-table-plain tbody:first-of-type th{padding-top:0 !important}.duet-table-flattened.duet-table-fixed td,.duet-table-flattened.duet-table-minimal td,.duet-table-flattened.duet-table-plain td,.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{border-bottom:0}.duet-table-flattened.duet-table-fixed tr,.duet-table-flattened.duet-table-minimal tr,.duet-table-flattened.duet-table-plain tr{padding:20px 0 !important}.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{padding-top:20px !important}.duet-table-flattened.duet-table-fixed tfoot td,.duet-table-flattened.duet-table-minimal tfoot td,.duet-table-flattened.duet-table-plain tfoot td{margin-bottom:4px !important}.duet-table-flattened.duet-table-fixed tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child{border-bottom:0}.duet-table-plain.duet-table-flattened tbody tr{border-bottom:1px solid #e1e3e6}.duet-table-plain.duet-table-flattened.duet-theme-turva tbody tr{border-bottom-color:#e4e4e6}.duet-table-minimal tbody tr,.duet-table-minimal tbody tr td{vertical-align:top;border-bottom:0 none}.duet-table-minimal tbody tr:last-of-type,.duet-table-minimal tbody tr:last-of-type td{border-bottom:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened tbody tr,.duet-table-minimal.duet-table-flattened tbody tr td{border-bottom:0 none}.duet-table-minimal.duet-table-flattened tbody tr td[data-heading]::before{display:none}.duet-table-minimal.duet-table-flattened tfoot{border-top:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened.duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-fixed table{table-layout:fixed}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td,.duet-table-fixed tbody tr td:first-child{padding:4px !important;vertical-align:text-bottom;border-bottom:0 none}.duet-table-fixed thead{display:none}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td{border-bottom:0 none}.duet-table-fixed:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-fixed:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-scrollable{position:relative;width:100%;overflow-x:auto;background:linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0)), linear-gradient(-90deg, #fff 0%, rgba(255, 255, 255, 0)) 100% 0, radial-gradient(farthest-side at 0% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) 100% 0%;background-repeat:no-repeat;background-attachment:local, local, scroll, scroll;background-size:100px 100%, 100px 100%, 12px 100%, 12px 100%}.duet-table-selected-column{background:rgba(0, 119, 179, 0.08)}.duet-theme-turva .duet-table-selected-column{background:rgba(68, 68, 69, 0.08)}.duet-table-sortable tbody tr td:first-child,.duet-table-sortable thead tr th:first-child{padding:20px}.duet-table-sortable:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-sortable:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-actions table{table-layout:auto}.duet-table-actions thead th:last-child{width:1px;white-space:nowrap}";
287
230
 
288
231
  // remove wrapping speech marks.
289
232
  // media query tokens are wrapped in speech marks,
@@ -343,9 +286,9 @@ let DuetTable = class {
343
286
  }
344
287
  connectedCallback() {
345
288
  this.mq = matchMedia(breakpointToToken[this.breakpoint]);
346
- this.mq.addEventListener("change", this.handleMediaQueryChange);
289
+ this.mq.addEventListener("change", jsUtils.debounce(this.handleMediaQueryChange, 50));
347
290
  this.handleMediaQueryChange(this.mq);
348
- this.observer = new MutationObserver(() => this.copyHeadingsToCells());
291
+ this.observer = new MutationObserver(() => jsUtils.debounce(this.copyHeadingsToCells(), 50));
349
292
  this.observer.observe(this.element, {
350
293
  childList: true,
351
294
  subtree: true,
@@ -376,6 +319,9 @@ let DuetTable = class {
376
319
  this.mq = null;
377
320
  this.matchesBreakpoint = true;
378
321
  }
322
+ /**
323
+ * Local methods.
324
+ */
379
325
  copyHeadingsToCells() {
380
326
  const headingElements = this.element.querySelectorAll("thead th");
381
327
  const rowElements = this.element.querySelectorAll("tbody tr");
@@ -651,7 +597,7 @@ const validateFile = (item, validators) => {
651
597
  if (item) {
652
598
  const { name, type, size } = item;
653
599
  const mime = validateFileMime(type, allowedMimetypes);
654
- const ext = validateFileExtension(name, allowedExtensions);
600
+ const ext = validateFileExtension(name.toLowerCase(), allowedExtensions);
655
601
  const bytes = validateFileSize(size, maxBytes);
656
602
  if (!mime) {
657
603
  errorMessage = getError("duet-upload-101");
@@ -731,7 +677,7 @@ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress })
731
677
  return xhr;
732
678
  };
733
679
 
734
- const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}";
680
+ const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}.duet-upload-editable-table-header-hidden{display:none}.duet-upload-editable-table tbody .duet-upload-editable-table-data{padding:0 !important;border:0}.duet-upload-editable-table duet-editable-table tfoot,.duet-upload-editable-table duet-editable-table thead{display:none}.duet-upload-editable-table duet-editable-table .duet-editable-table-content{padding-right:0 !important;padding-left:0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td{padding:0.75rem 0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td:last-child{padding-right:0 !important}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress duet-action-button::part(button){border:0}";
735
681
 
736
682
  let DuetUpload = class {
737
683
  constructor(hostRef) {
@@ -745,25 +691,6 @@ let DuetUpload = class {
745
691
  this.duetCancel = index.createEvent(this, "duetCancel", 3);
746
692
  this.duetProgress = index.createEvent(this, "duetProgress", 3);
747
693
  this.duetUpload = index.createEvent(this, "duetUpload", 3);
748
- /**
749
- * Own Properties
750
- */
751
- this.buttonId = createId.createID("DuetButton");
752
- this.labelId = createId.createID("DuetLabel");
753
- this.uploadId = createId.createID("DuetUpload");
754
- this.editableTableId = createId.createID("DuetEditableTable");
755
- this.filesInProgress = new Map();
756
- this.fileMaxReached = false;
757
- this.bytesMaxReached = false;
758
- this.internalStatusMessageLabel = undefined;
759
- /**
760
- * Properties
761
- */
762
- this.DefaultGroups = {
763
- inprogress: "inprogress",
764
- success: "success",
765
- failure: "failure",
766
- };
767
694
  /**
768
695
  * State() variables
769
696
  */
@@ -785,8 +712,9 @@ let DuetUpload = class {
785
712
  {
786
713
  icon: "action-delete",
787
714
  color: "color-danger",
788
- color_hover: "primary-dark",
789
- id: "delete",
715
+ size: "x-small",
716
+ background: "gray-lightest",
717
+ name: "delete",
790
718
  map: ["success", "failure"],
791
719
  label: {
792
720
  fi: "Poista tiedosto",
@@ -797,8 +725,9 @@ let DuetUpload = class {
797
725
  {
798
726
  icon: "navigation-close",
799
727
  color: "primary",
800
- color_hover: "primary-dark",
801
- id: "cancel",
728
+ size: "x-small",
729
+ background: "gray-lightest",
730
+ name: "cancel",
802
731
  map: ["inprogress"],
803
732
  label: {
804
733
  fi: "Keskeytä lähetys",
@@ -868,8 +797,8 @@ let DuetUpload = class {
868
797
  inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
869
798
  done: "All {filesTotal} added successfully",
870
799
  doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
871
- files: "tiedostoa",
872
- file: "tiedosto",
800
+ files: "File",
801
+ file: "file",
873
802
  },
874
803
  };
875
804
  /**
@@ -1024,19 +953,72 @@ let DuetUpload = class {
1024
953
  * by default this is off, setting this to true will limit the users choices to what has been explicitly set
1025
954
  */
1026
955
  this.limitSelection = false;
956
+ /**
957
+ * Own Properties
958
+ */
959
+ this.buttonId = createId.createID("DuetButton");
960
+ this.labelId = createId.createID("DuetLabel");
961
+ this.uploadId = createId.createID("DuetUpload");
962
+ this.filesInProgress = new Map();
963
+ this.fileMaxReached = false;
964
+ this.bytesMaxReached = false;
965
+ this.internalStatusMessageLabel = undefined;
966
+ /**
967
+ * Properties
968
+ */
969
+ this.DefaultGroups = {
970
+ inprogress: "inprogress",
971
+ success: "success",
972
+ failure: "failure",
973
+ };
974
+ /**
975
+ * Array of group names that you want the editable table to use to display files
976
+ * @required
977
+ * @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
978
+ */
979
+ this.groups = [
980
+ {
981
+ id: this.DefaultGroups.inprogress,
982
+ label: {
983
+ fi: "Kesken olevat tiedostot",
984
+ sv: "Filer inprogress",
985
+ en: "Files inprogress",
986
+ },
987
+ },
988
+ {
989
+ id: this.DefaultGroups.success,
990
+ label: {
991
+ fi: "Valmiit tiedostot",
992
+ sv: "Files success",
993
+ en: "Files success",
994
+ },
995
+ },
996
+ {
997
+ id: this.DefaultGroups.failure,
998
+ label: {
999
+ fi: "Tiedostot, joissa on virheitä",
1000
+ sv: "Filer med fel",
1001
+ en: "Files with errors",
1002
+ },
1003
+ },
1004
+ ];
1005
+ this.kick = jsUtils.debounce(() => {
1006
+ this.tick = Date.now();
1007
+ }, 30); // will trigger re-render
1027
1008
  /**
1028
1009
  * Private functions
1029
1010
  */
1030
1011
  this.listenForActionEvents = () => {
1031
- this.element.addEventListener("duetEditableItemAction", (e) => {
1012
+ this.element.addEventListener("duetActionEvent", (e) => {
1032
1013
  const detail = e.detail;
1033
- const { action, keyName, originalEvent } = detail;
1014
+ const { action, id, originalEvent } = detail;
1015
+ console.log(e);
1034
1016
  switch (action) {
1035
1017
  case "delete":
1036
- this.onDelete(keyName, originalEvent);
1018
+ this.onDelete(id, originalEvent);
1037
1019
  break;
1038
1020
  case "cancel":
1039
- this.onCancel(keyName, originalEvent);
1021
+ this.onCancel(id, originalEvent);
1040
1022
  break;
1041
1023
  // code block
1042
1024
  }
@@ -1093,24 +1075,6 @@ let DuetUpload = class {
1093
1075
  return "none";
1094
1076
  }
1095
1077
  };
1096
- this.convertToDuetEditableTableItems = () => {
1097
- // we're always recreating the map - in order to force an update down stream.
1098
- const itemData = new Map();
1099
- //walk the files Map and convert to DuetEditableTableItemData
1100
- this.files.forEach((data, key, _originalMap) => {
1101
- const group = this.getGroupFromItemData(data);
1102
- const item = this.getItemHTMLFromItemData(data, group);
1103
- itemData.set(key, {
1104
- uid: data.uid,
1105
- item,
1106
- group,
1107
- });
1108
- });
1109
- return itemData;
1110
- };
1111
- this.kick = jsUtils.debounce(() => {
1112
- this.tick = Date.now();
1113
- }, 30); // will trigger re-render
1114
1078
  this.genHashName = () => Date.now().toString(36) + Math.random();
1115
1079
  this.updateValueInMap = (item, key, value, kick = true) => {
1116
1080
  const fileItem = this.files.get(item);
@@ -1171,7 +1135,6 @@ let DuetUpload = class {
1171
1135
  this.nativeInput.value = "";
1172
1136
  };
1173
1137
  this.startUpload = async (ev, metaData = undefined) => {
1174
- await this.setFocus();
1175
1138
  this.metaData = metaData;
1176
1139
  this.nativeInput.click();
1177
1140
  this.onUpload(ev, metaData);
@@ -1234,9 +1197,18 @@ let DuetUpload = class {
1234
1197
  fileMaxReached: isTotalFileAmountAboveMax,
1235
1198
  };
1236
1199
  };
1200
+ this.getItemFromUID = (uid) => {
1201
+ for (const [key, value] of this.files.entries()) {
1202
+ if (value.uid === uid) {
1203
+ return { value, key };
1204
+ }
1205
+ }
1206
+ return null;
1207
+ };
1237
1208
  this.onDelete = (key, ev) => {
1238
- const deletedItem = this.files.get(key);
1239
- this.files.delete(key);
1209
+ const retrievedKey = this.getItemFromUID(key).key;
1210
+ const deletedItem = this.files.get(retrievedKey);
1211
+ this.files.delete(retrievedKey);
1240
1212
  this.validateTotals();
1241
1213
  this.kick();
1242
1214
  this.duetDelete.emit({
@@ -1250,8 +1222,9 @@ let DuetUpload = class {
1250
1222
  this.resetFormFields();
1251
1223
  };
1252
1224
  this.onCancel = (key, ev) => {
1253
- const cancelledItem = this.files.get(key);
1254
- this.files.delete(key);
1225
+ const retrievedKey = this.getItemFromUID(key).key;
1226
+ const cancelledItem = this.files.get(retrievedKey);
1227
+ this.files.delete(retrievedKey);
1255
1228
  if (!this.external) {
1256
1229
  const { xhr } = cancelledItem;
1257
1230
  xhr.abort();
@@ -1301,6 +1274,79 @@ let DuetUpload = class {
1301
1274
  data: { files: this.files },
1302
1275
  });
1303
1276
  };
1277
+ /**
1278
+ * @description This functions return sorted map items byg condition which are:
1279
+ */
1280
+ this.filterMap = () => {
1281
+ const all = [...this.files.values()];
1282
+ const inprogress = [];
1283
+ const failure = [];
1284
+ const success = [];
1285
+ all.forEach(data => {
1286
+ const group = this.getGroupFromItemData(data);
1287
+ const item = this.getItemHTMLFromItemData(data, group);
1288
+ if (group === this.DefaultGroups.success) {
1289
+ success.push({
1290
+ uid: data.uid,
1291
+ item,
1292
+ group,
1293
+ });
1294
+ }
1295
+ else if (group === this.DefaultGroups.inprogress) {
1296
+ inprogress.push({
1297
+ uid: data.uid,
1298
+ item,
1299
+ group,
1300
+ });
1301
+ }
1302
+ else if (group === this.DefaultGroups.failure) {
1303
+ failure.push({
1304
+ uid: data.uid,
1305
+ item,
1306
+ group,
1307
+ });
1308
+ }
1309
+ else if (data.group) {
1310
+ inprogress.push({
1311
+ uid: data.uid,
1312
+ item,
1313
+ group: data.group,
1314
+ });
1315
+ }
1316
+ });
1317
+ return {
1318
+ inprogress,
1319
+ failure,
1320
+ success,
1321
+ };
1322
+ };
1323
+ this.getColumns = (group) => {
1324
+ return [
1325
+ {
1326
+ sort_order: 1,
1327
+ direction: 1,
1328
+ index: 0,
1329
+ key: group.id,
1330
+ label: group.label,
1331
+ },
1332
+ ];
1333
+ };
1334
+ this.getActions = (id) => {
1335
+ return this.actions.filter(item => item.map.includes(id));
1336
+ };
1337
+ this.renderEditableTableGroups = () => {
1338
+ const filteredItems = this.filterMap();
1339
+ const EditableTables = this.groups.map(group => {
1340
+ const currentItems = filteredItems[group.id];
1341
+ if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
1342
+ return;
1343
+ }
1344
+ return (index.h("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" }, index.h("table", { class: "duet-upload-editable-table" }, index.h("thead", { class: "duet-upload-editable-table-header" }, index.h("tr", null, index.h("th", { class: {
1345
+ "duet-upload-editable-table-header-hidden": this.hideGroups,
1346
+ } }, !this.hideGroups ? (languageUtils.getLocaleString(group.label)) : (index.h("duet-visually-hidden", null, languageUtils.getLocaleString(group.label)))))), index.h("tbody", null, index.h("tr", null, index.h("td", { class: "duet-upload-editable-table-data" }, index.h("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
1347
+ });
1348
+ return EditableTables;
1349
+ };
1304
1350
  }
1305
1351
  watchValidHandler(newValue, oldValue) {
1306
1352
  if (newValue !== oldValue) {
@@ -1324,6 +1370,68 @@ let DuetUpload = class {
1324
1370
  // listen to the events from the component
1325
1371
  this.verifyValidity();
1326
1372
  }
1373
+ /**
1374
+ * Sets focus on the specified `duet-input`. Use this method instead of the global
1375
+ * `input.focus()`.
1376
+ */
1377
+ async setFocus(options) {
1378
+ if (this.nativeInput) {
1379
+ this.nativeInput.focus(options);
1380
+ }
1381
+ return;
1382
+ }
1383
+ /**
1384
+ * Method for invoking the upload sequence
1385
+ */
1386
+ async upload(metaData = undefined) {
1387
+ await this.setFocus();
1388
+ this.metaData = metaData;
1389
+ this.nativeInput.click();
1390
+ return;
1391
+ }
1392
+ /**
1393
+ * Method for forcing a render of the upload list, element.files can be changed externally
1394
+ * But it will only rerender on a new Map or a top Level change - this can be used to update
1395
+ * the tabular data if the automatic re-render is no sufficient
1396
+ */
1397
+ async refresh() {
1398
+ this.kick();
1399
+ await this.setFocus();
1400
+ }
1401
+ /**
1402
+ * Get list of files, divided in errors and valid sections
1403
+ */
1404
+ async getFiles() {
1405
+ if (!this.files || this.files.size === 0) {
1406
+ return false;
1407
+ }
1408
+ return this.getFilesAsArray();
1409
+ }
1410
+ /**
1411
+ * Convenience method for updating the value of a key:value inside an item in the files attribute
1412
+ */
1413
+ async updateValue(item, key, value) {
1414
+ this.updateValueInMap(item, key, value);
1415
+ }
1416
+ /**
1417
+ * render() function
1418
+ * Always the last one in the class.
1419
+ */
1420
+ render() {
1421
+ const identifier = this.identifier || this.uploadId;
1422
+ let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
1423
+ caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
1424
+ caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
1425
+ return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
1426
+ "duet-upload-filelist-empty": !this.files.size,
1427
+ "duet-upload-filelist": true,
1428
+ "duet-upload-filelist-filled": this.files.size,
1429
+ }, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && this.renderEditableTableGroups(), !!this.files.size && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
1430
+ this.nativeInput = input;
1431
+ }, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
1432
+ "duet-upload": true,
1433
+ }, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
1434
+ }
1327
1435
  /**
1328
1436
  * XHR request utilities
1329
1437
  */
@@ -1445,68 +1553,6 @@ let DuetUpload = class {
1445
1553
  component: "duet-upload",
1446
1554
  });
1447
1555
  }
1448
- /**
1449
- * Sets focus on the specified `duet-input`. Use this method instead of the global
1450
- * `input.focus()`.
1451
- */
1452
- async setFocus(options) {
1453
- if (this.nativeInput) {
1454
- this.nativeInput.focus(options);
1455
- }
1456
- return;
1457
- }
1458
- /**
1459
- * Method for invoking the upload sequence
1460
- */
1461
- async upload(metaData = undefined) {
1462
- await this.setFocus();
1463
- this.metaData = metaData;
1464
- this.nativeInput.click();
1465
- return;
1466
- }
1467
- /**
1468
- * Method for forcing a render of the upload list, element.files can be changed externally
1469
- * But it will only rerender on a new Map or a top Level change - this can be used to update
1470
- * the tabular data if the automatic re-render is no sufficient
1471
- */
1472
- async refresh() {
1473
- this.kick();
1474
- await this.setFocus();
1475
- }
1476
- /**
1477
- * Get list of files, divided in errors and valid sections
1478
- */
1479
- async getFiles() {
1480
- if (!this.files || this.files.size === 0) {
1481
- return false;
1482
- }
1483
- return this.getFilesAsArray();
1484
- }
1485
- /**
1486
- * Convenience method for updating the value of a key:value inside an item in the files attribute
1487
- */
1488
- async updateValue(item, key, value) {
1489
- this.updateValueInMap(item, key, value);
1490
- }
1491
- /**
1492
- * render() function
1493
- * Always the last one in the class.
1494
- */
1495
- render() {
1496
- const identifier = this.identifier || this.uploadId;
1497
- let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
1498
- caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
1499
- caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
1500
- return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
1501
- "duet-upload-filelist-empty": !this.files.size,
1502
- "duet-upload-filelist": true,
1503
- "duet-upload-filelist-filled": this.files.size,
1504
- }, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && (index.h("duet-editable-table", { part: this.identifier ? `${this.identifier}-editable-table` : "duet-upload-editable-table", "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, alignment: this.alignment, items: this.convertToDuetEditableTableItems() })), !!this.files.size && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
1505
- this.nativeInput = input;
1506
- }, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
1507
- "duet-upload": true,
1508
- }, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
1509
- }
1510
1556
  get element() { return index.getElement(this); }
1511
1557
  static get watchers() { return {
1512
1558
  "valid": ["watchValidHandler"]
@@ -1515,6 +1561,5 @@ let DuetUpload = class {
1515
1561
  DuetUpload.style = duetUploadCss;
1516
1562
 
1517
1563
  exports.duet_editable_table = DuetEditableTable;
1518
- exports.duet_editable_table_item = DuetEditableTableItem;
1519
1564
  exports.duet_table = DuetTable;
1520
1565
  exports.duet_upload = DuetUpload;