@duetds/components 5.2.0 → 5.2.3

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 (270) hide show
  1. package/hydrate/index.js +186 -100
  2. package/lib/cjs/{dom-66424ef2.js → dom-96576bce.js} +1 -1
  3. package/lib/cjs/duet-action-button.cjs.entry.js +1 -1
  4. package/lib/cjs/duet-alert.cjs.entry.js +1 -1
  5. package/lib/cjs/duet-badge.cjs.entry.js +1 -1
  6. package/lib/cjs/duet-breadcrumb.cjs.entry.js +1 -1
  7. package/lib/cjs/duet-breadcrumbs.cjs.entry.js +1 -1
  8. package/lib/cjs/duet-button_2.cjs.entry.js +1 -1
  9. package/lib/cjs/duet-caption_4.cjs.entry.js +1 -1
  10. package/lib/cjs/duet-card.cjs.entry.js +1 -1
  11. package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
  12. package/lib/cjs/duet-choice_2.cjs.entry.js +2 -2
  13. package/lib/cjs/duet-collapsible.cjs.entry.js +1 -1
  14. package/lib/cjs/duet-combobox.cjs.entry.js +1 -1
  15. package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
  16. package/lib/cjs/duet-date-picker.cjs.entry.js +2 -2
  17. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
  18. package/lib/cjs/duet-editable-table_3.cjs.entry.js +4 -3
  19. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
  20. package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
  21. package/lib/cjs/duet-footer.cjs.entry.js +1 -1
  22. package/lib/cjs/duet-grid_2.cjs.entry.js +1 -1
  23. package/lib/cjs/duet-header_2.cjs.entry.js +1 -1
  24. package/lib/cjs/duet-hero.cjs.entry.js +1 -1
  25. package/lib/cjs/duet-icon.cjs.entry.js +1 -1
  26. package/lib/cjs/duet-input_2.cjs.entry.js +1 -1
  27. package/lib/cjs/duet-layout.cjs.entry.js +1 -1
  28. package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
  29. package/lib/cjs/duet-modal.cjs.entry.js +2 -2
  30. package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
  31. package/lib/cjs/duet-number-input.cjs.entry.js +92 -47
  32. package/lib/cjs/duet-pagination_2.cjs.entry.js +39 -17
  33. package/lib/cjs/duet-progress.cjs.entry.js +1 -1
  34. package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
  35. package/lib/cjs/duet-range-slider.cjs.entry.js +1 -1
  36. package/lib/cjs/duet-scrollable_3.cjs.entry.js +1 -1
  37. package/lib/cjs/duet-select.cjs.entry.js +1 -1
  38. package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
  39. package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
  40. package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
  41. package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
  42. package/lib/cjs/duet-tray.cjs.entry.js +1 -1
  43. package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
  44. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  45. package/lib/cjs/duet.cjs.js +4 -4
  46. package/lib/cjs/{focus-utils-bfb10d32.js → focus-utils-12f0a2cb.js} +1 -1
  47. package/lib/cjs/{index-a4844346.js → index-ba78fa3c.js} +11 -9
  48. package/lib/cjs/loader.cjs.js +3 -3
  49. package/lib/cjs/{shadow-css-1ff2f74f.js → shadow-css-38b9e725.js} +2 -3
  50. package/lib/collection/collection-manifest.json +1 -1
  51. package/lib/collection/components/duet-editable-table/duet-editable-table.js +2 -1
  52. package/lib/collection/components/duet-number-input/duet-number-input.js +22 -27
  53. package/lib/collection/components/duet-pagination/duet-pagination.js +18 -13
  54. package/lib/collection/components/duet-range-stepper/duet-range-stepper.js +28 -11
  55. package/lib/collection/components/duet-table/duet-table.css +30 -18
  56. package/lib/collection/utils/math.utils.js +76 -0
  57. package/lib/custom-elements-bundle/index.js +145 -78
  58. package/lib/duet/duet.esm.js +1 -1
  59. package/lib/duet/duet.js +1 -1
  60. package/lib/duet/{p-285714dd.entry.js → p-0146f86f.entry.js} +1 -1
  61. package/lib/duet/{p-b0a4dc6d.entry.js → p-02fdca38.entry.js} +1 -1
  62. package/lib/duet/{p-99fe93c6.system.entry.js → p-034aa5af.system.entry.js} +1 -1
  63. package/lib/duet/{p-f5613315.system.entry.js → p-072a20bb.system.entry.js} +1 -1
  64. package/lib/duet/{p-b35d6368.system.entry.js → p-07970e02.system.entry.js} +1 -1
  65. package/lib/duet/{p-fbec1a47.entry.js → p-119b3a75.entry.js} +1 -1
  66. package/lib/duet/{p-423d4211.system.entry.js → p-12eb57c0.system.entry.js} +1 -1
  67. package/lib/duet/{p-78de93b3.entry.js → p-17d0567c.entry.js} +1 -1
  68. package/lib/duet/p-1919ea71.system.entry.js +4 -0
  69. package/lib/duet/{p-97f1e254.entry.js → p-1b03c0b0.entry.js} +1 -1
  70. package/lib/duet/p-1d3fe5c7.js +5 -0
  71. package/lib/duet/{p-b4ca3864.system.entry.js → p-1d557ffa.system.entry.js} +1 -1
  72. package/lib/duet/{p-6a843f9e.entry.js → p-1e124cda.entry.js} +1 -1
  73. package/lib/duet/p-28ed49f6.entry.js +4 -0
  74. package/lib/duet/{p-e8f8374b.system.entry.js → p-2b1098f7.system.entry.js} +1 -1
  75. package/lib/duet/{p-271107d8.entry.js → p-30c2a422.entry.js} +1 -1
  76. package/lib/duet/{p-b16befbc.system.entry.js → p-36ad89c8.system.entry.js} +1 -1
  77. package/lib/duet/{p-fef3a403.system.entry.js → p-38d81ea7.system.entry.js} +1 -1
  78. package/lib/duet/{p-e7b761c5.system.js → p-392d3906.system.js} +1 -1
  79. package/lib/duet/{p-00bf0bb9.system.entry.js → p-3a1bcb33.system.entry.js} +1 -1
  80. package/lib/duet/{p-fa59ebf4.js → p-3b31184e.js} +0 -0
  81. package/lib/duet/{p-360f8fff.system.entry.js → p-3dcf6143.system.entry.js} +1 -1
  82. package/lib/duet/{p-ec6d63fc.entry.js → p-45fce3bd.entry.js} +1 -1
  83. package/lib/duet/{p-bf87d801.entry.js → p-4d661df0.entry.js} +1 -1
  84. package/lib/duet/{p-41cc3490.entry.js → p-4d6b63bd.entry.js} +1 -1
  85. package/lib/duet/{p-c0aca70c.entry.js → p-4dfd691c.entry.js} +1 -1
  86. package/lib/duet/{p-7a4764db.system.entry.js → p-4e1342e8.system.entry.js} +1 -1
  87. package/lib/duet/{p-d4dba079.system.entry.js → p-506d7234.system.entry.js} +1 -1
  88. package/lib/duet/{p-bb4d8e7b.entry.js → p-518d507a.entry.js} +1 -1
  89. package/lib/duet/{p-437fe50b.system.entry.js → p-532a7563.system.entry.js} +1 -1
  90. package/lib/duet/{p-790ee851.entry.js → p-5de61303.entry.js} +1 -1
  91. package/lib/duet/{p-a2fa0049.entry.js → p-62635fbd.entry.js} +1 -1
  92. package/lib/duet/p-63536b2d.entry.js +4 -0
  93. package/lib/duet/{p-01478a01.system.entry.js → p-64469525.system.entry.js} +1 -1
  94. package/lib/duet/{p-53ad61ed.entry.js → p-65527b10.entry.js} +1 -1
  95. package/lib/duet/{p-98039227.system.entry.js → p-68b86cf3.system.entry.js} +1 -1
  96. package/lib/duet/{p-c1d55269.system.entry.js → p-6a4e52a8.system.entry.js} +1 -1
  97. package/lib/duet/{p-fd0a3ab7.entry.js → p-6b7706d1.entry.js} +1 -1
  98. package/lib/duet/{p-1ff51ad8.system.entry.js → p-6e7f309d.system.entry.js} +1 -1
  99. package/lib/duet/p-6e853c11.system.entry.js +4 -0
  100. package/lib/duet/{p-9920ad3b.entry.js → p-70a3b04a.entry.js} +1 -1
  101. package/lib/duet/{p-cb8ebdd7.entry.js → p-72975917.entry.js} +1 -1
  102. package/lib/duet/{p-ee97a406.system.entry.js → p-73c4e3a3.system.entry.js} +1 -1
  103. package/lib/duet/{p-f91e88e3.system.entry.js → p-78627725.system.entry.js} +1 -1
  104. package/lib/duet/{p-641edb93.system.entry.js → p-7adfeba7.system.entry.js} +1 -1
  105. package/lib/duet/{p-88ffd1cc.entry.js → p-82492a56.entry.js} +1 -1
  106. package/lib/duet/p-835fbc11.js +4 -0
  107. package/lib/duet/{p-10585f06.system.entry.js → p-84a7b980.system.entry.js} +1 -1
  108. package/lib/duet/{p-9406ee60.entry.js → p-856b4648.entry.js} +1 -1
  109. package/lib/duet/{p-04061cef.entry.js → p-89fa490e.entry.js} +1 -1
  110. package/lib/duet/{p-72739cec.entry.js → p-8bc46a6e.entry.js} +1 -1
  111. package/lib/duet/{p-24721182.system.entry.js → p-8bd8f3b9.system.entry.js} +1 -1
  112. package/lib/duet/{p-05e069d8.entry.js → p-8e2ec8a1.entry.js} +1 -1
  113. package/lib/duet/{p-56d3e64f.entry.js → p-8eeccac4.entry.js} +1 -1
  114. package/lib/duet/{p-95a0db46.entry.js → p-92ab9288.entry.js} +1 -1
  115. package/lib/duet/{p-030e20d7.entry.js → p-96d1c0b2.entry.js} +1 -1
  116. package/lib/duet/{p-7021d0c6.system.entry.js → p-97a5f165.system.entry.js} +1 -1
  117. package/lib/duet/{p-071ebe1d.system.entry.js → p-9c850ee8.system.entry.js} +1 -1
  118. package/lib/duet/{p-0bee3151.system.entry.js → p-9fb0854f.system.entry.js} +1 -1
  119. package/lib/duet/{p-afd34b6b.system.entry.js → p-a2f3f08d.system.entry.js} +1 -1
  120. package/lib/duet/p-a81531cf.system.js +4 -0
  121. package/lib/duet/{p-08eb2200.entry.js → p-a9f17642.entry.js} +1 -1
  122. package/lib/duet/{p-d33b5ac5.system.entry.js → p-ab1cda11.system.entry.js} +1 -1
  123. package/lib/duet/{p-64685397.entry.js → p-ae7e7fbf.entry.js} +1 -1
  124. package/lib/duet/{p-76e38bb2.system.entry.js → p-b3dba7d7.system.entry.js} +1 -1
  125. package/lib/duet/{p-542af014.system.js → p-b668b67c.system.js} +0 -0
  126. package/lib/duet/{p-c7657242.entry.js → p-baf2428d.entry.js} +1 -1
  127. package/lib/duet/p-bb65d334.system.entry.js +4 -0
  128. package/lib/duet/{p-03b6ce80.entry.js → p-bbf4391c.entry.js} +1 -1
  129. package/lib/duet/{p-a509cc2b.system.entry.js → p-c54d7981.system.entry.js} +1 -1
  130. package/lib/duet/p-c6791e18.system.js +5 -0
  131. package/lib/duet/{p-e75c7aa8.system.entry.js → p-c6d4025f.system.entry.js} +1 -1
  132. package/lib/duet/{p-73cd4f03.system.entry.js → p-c6d99598.system.entry.js} +1 -1
  133. package/lib/duet/{p-19100783.system.entry.js → p-c75db094.system.entry.js} +1 -1
  134. package/lib/duet/{p-b08bb1fd.entry.js → p-c9c6d840.entry.js} +1 -1
  135. package/lib/duet/{p-495a1326.system.entry.js → p-cfcb5990.system.entry.js} +1 -1
  136. package/lib/duet/{p-95e1a336.entry.js → p-d16b2352.entry.js} +1 -1
  137. package/lib/duet/{p-5f009925.system.entry.js → p-d1f678be.system.entry.js} +1 -1
  138. package/lib/duet/{p-27d238c5.js → p-d4c234ed.js} +1 -1
  139. package/lib/duet/{p-7fe67436.system.entry.js → p-d506da98.system.entry.js} +1 -1
  140. package/lib/duet/{p-b8623ab8.entry.js → p-d96432a0.entry.js} +1 -1
  141. package/lib/duet/{p-5b1cbe5b.entry.js → p-dc5971bf.entry.js} +1 -1
  142. package/lib/duet/{p-3260eef0.entry.js → p-de6e8bfb.entry.js} +1 -1
  143. package/lib/duet/{p-30e901f2.system.entry.js → p-dfff5f16.system.entry.js} +1 -1
  144. package/lib/duet/{p-0ae816ee.entry.js → p-e27f1382.entry.js} +1 -1
  145. package/lib/duet/{p-68cbc3b7.entry.js → p-e2cc3eb4.entry.js} +1 -1
  146. package/lib/duet/{p-9496d6d4.entry.js → p-e575b990.entry.js} +1 -1
  147. package/lib/duet/{p-a843e579.system.entry.js → p-ee6352cf.system.entry.js} +1 -1
  148. package/lib/duet/{p-4a7f290f.entry.js → p-f66e69a0.entry.js} +1 -1
  149. package/lib/duet/p-f80195fa.entry.js +4 -0
  150. package/lib/duet/{p-b51928dc.system.entry.js → p-fd8ac2e7.system.entry.js} +1 -1
  151. package/lib/duet/{p-33388bf3.system.entry.js → p-febd0192.system.entry.js} +1 -1
  152. package/lib/duet/p-ff46ec81.system.js +16 -0
  153. package/lib/esm/{dom-3c479050.js → dom-3dbcb0d8.js} +1 -1
  154. package/lib/esm/duet-action-button.entry.js +1 -1
  155. package/lib/esm/duet-alert.entry.js +1 -1
  156. package/lib/esm/duet-badge.entry.js +1 -1
  157. package/lib/esm/duet-breadcrumb.entry.js +1 -1
  158. package/lib/esm/duet-breadcrumbs.entry.js +1 -1
  159. package/lib/esm/duet-button_2.entry.js +1 -1
  160. package/lib/esm/duet-caption_4.entry.js +1 -1
  161. package/lib/esm/duet-card.entry.js +1 -1
  162. package/lib/esm/duet-checkbox.entry.js +1 -1
  163. package/lib/esm/duet-choice_2.entry.js +2 -2
  164. package/lib/esm/duet-collapsible.entry.js +1 -1
  165. package/lib/esm/duet-combobox.entry.js +1 -1
  166. package/lib/esm/duet-cookie-consent.entry.js +1 -1
  167. package/lib/esm/duet-date-picker.entry.js +2 -2
  168. package/lib/esm/duet-divider_2.entry.js +1 -1
  169. package/lib/esm/duet-editable-table_3.entry.js +4 -3
  170. package/lib/esm/duet-empty-state.entry.js +1 -1
  171. package/lib/esm/duet-fieldset.entry.js +1 -1
  172. package/lib/esm/duet-footer.entry.js +1 -1
  173. package/lib/esm/duet-grid_2.entry.js +1 -1
  174. package/lib/esm/duet-header_2.entry.js +1 -1
  175. package/lib/esm/duet-hero.entry.js +1 -1
  176. package/lib/esm/duet-icon.entry.js +1 -1
  177. package/lib/esm/duet-input_2.entry.js +1 -1
  178. package/lib/esm/duet-layout.entry.js +1 -1
  179. package/lib/esm/duet-list_2.entry.js +1 -1
  180. package/lib/esm/duet-modal.entry.js +2 -2
  181. package/lib/esm/duet-notification_2.entry.js +1 -1
  182. package/lib/esm/duet-number-input.entry.js +92 -47
  183. package/lib/esm/duet-pagination_2.entry.js +39 -17
  184. package/lib/esm/duet-progress.entry.js +1 -1
  185. package/lib/esm/duet-radio_2.entry.js +1 -1
  186. package/lib/esm/duet-range-slider.entry.js +1 -1
  187. package/lib/esm/duet-scrollable_3.entry.js +1 -1
  188. package/lib/esm/duet-select.entry.js +1 -1
  189. package/lib/esm/duet-step_2.entry.js +1 -1
  190. package/lib/esm/duet-textarea.entry.js +1 -1
  191. package/lib/esm/duet-toggle.entry.js +1 -1
  192. package/lib/esm/duet-tooltip.entry.js +1 -1
  193. package/lib/esm/duet-tray.entry.js +1 -1
  194. package/lib/esm/duet-upload-aria-status.entry.js +1 -1
  195. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  196. package/lib/esm/duet.js +4 -4
  197. package/lib/esm/{focus-utils-3af074ea.js → focus-utils-3769afc3.js} +1 -1
  198. package/lib/esm/{index-ab2bfa68.js → index-374256c8.js} +11 -9
  199. package/lib/esm/loader.js +3 -3
  200. package/lib/esm/polyfills/css-shim.js +1 -1
  201. package/lib/esm/{shadow-css-fbe49d20.js → shadow-css-501eda9a.js} +2 -3
  202. package/lib/esm-es5/{dom-3c479050.js → dom-3dbcb0d8.js} +0 -0
  203. package/lib/esm-es5/duet-action-button.entry.js +1 -1
  204. package/lib/esm-es5/duet-alert.entry.js +1 -1
  205. package/lib/esm-es5/duet-badge.entry.js +1 -1
  206. package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
  207. package/lib/esm-es5/duet-breadcrumbs.entry.js +1 -1
  208. package/lib/esm-es5/duet-button_2.entry.js +1 -1
  209. package/lib/esm-es5/duet-caption_4.entry.js +1 -1
  210. package/lib/esm-es5/duet-card.entry.js +1 -1
  211. package/lib/esm-es5/duet-checkbox.entry.js +1 -1
  212. package/lib/esm-es5/duet-choice_2.entry.js +2 -2
  213. package/lib/esm-es5/duet-collapsible.entry.js +1 -1
  214. package/lib/esm-es5/duet-combobox.entry.js +1 -1
  215. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  216. package/lib/esm-es5/duet-date-picker.entry.js +1 -1
  217. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  218. package/lib/esm-es5/duet-editable-table_3.entry.js +2 -2
  219. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  220. package/lib/esm-es5/duet-fieldset.entry.js +1 -1
  221. package/lib/esm-es5/duet-footer.entry.js +1 -1
  222. package/lib/esm-es5/duet-grid_2.entry.js +1 -1
  223. package/lib/esm-es5/duet-header_2.entry.js +1 -1
  224. package/lib/esm-es5/duet-hero.entry.js +1 -1
  225. package/lib/esm-es5/duet-icon.entry.js +1 -1
  226. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  227. package/lib/esm-es5/duet-layout.entry.js +1 -1
  228. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  229. package/lib/esm-es5/duet-modal.entry.js +1 -1
  230. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  231. package/lib/esm-es5/duet-number-input.entry.js +2 -2
  232. package/lib/esm-es5/duet-pagination_2.entry.js +1 -1
  233. package/lib/esm-es5/duet-progress.entry.js +1 -1
  234. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  235. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  236. package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
  237. package/lib/esm-es5/duet-select.entry.js +1 -1
  238. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  239. package/lib/esm-es5/duet-textarea.entry.js +1 -1
  240. package/lib/esm-es5/duet-toggle.entry.js +1 -1
  241. package/lib/esm-es5/duet-tooltip.entry.js +1 -1
  242. package/lib/esm-es5/duet-tray.entry.js +1 -1
  243. package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
  244. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  245. package/lib/esm-es5/duet.js +1 -1
  246. package/lib/esm-es5/{focus-utils-3af074ea.js → focus-utils-3769afc3.js} +1 -1
  247. package/lib/esm-es5/index-374256c8.js +5 -0
  248. package/lib/esm-es5/loader.js +1 -1
  249. package/lib/esm-es5/shadow-css-501eda9a.js +15 -0
  250. package/lib/types/components/duet-number-input/duet-number-input.d.ts +0 -1
  251. package/lib/types/components/duet-pagination/duet-pagination.d.ts +1 -1
  252. package/lib/types/components/duet-range-stepper/duet-range-stepper.d.ts +3 -1
  253. package/lib/types/components.d.ts +192 -80
  254. package/lib/types/utils/math.utils.d.ts +11 -0
  255. package/package.json +6 -6
  256. package/lib/collection/components/duet-number-input/number-input-utils.js +0 -26
  257. package/lib/duet/p-12c89686.system.js +0 -4
  258. package/lib/duet/p-37dc064c.js +0 -4
  259. package/lib/duet/p-4972c76e.system.js +0 -4
  260. package/lib/duet/p-5a5d8fb1.entry.js +0 -4
  261. package/lib/duet/p-66536958.system.entry.js +0 -4
  262. package/lib/duet/p-92a25fb5.system.js +0 -16
  263. package/lib/duet/p-971f42d6.system.entry.js +0 -4
  264. package/lib/duet/p-98a9556f.js +0 -4
  265. package/lib/duet/p-a76bf729.entry.js +0 -4
  266. package/lib/duet/p-b7462f8c.system.entry.js +0 -4
  267. package/lib/duet/p-fe99b9cb.entry.js +0 -4
  268. package/lib/esm-es5/index-ab2bfa68.js +0 -4
  269. package/lib/esm-es5/shadow-css-fbe49d20.js +0 -15
  270. package/lib/types/components/duet-number-input/number-input-utils.d.ts +0 -4
@@ -8,7 +8,7 @@ import { inheritGlobalTheme } from "../../common";
8
8
  import { createID } from "../../utils/create-id";
9
9
  import { isArrowDownKey, isArrowLeftKey, isArrowRightKey, isArrowUpKey, isBackspaceKey, } from "../../utils/keyboard-utils";
10
10
  import { getLanguage, getLocale, getLocaleString } from "../../utils/language-utils";
11
- import { clamp, parseLocaleFloat, roundTo } from "./number-input-utils";
11
+ import { clamp, roundTo, SafeParseFloat } from "../../utils/math.utils";
12
12
  export class DuetNumberInput {
13
13
  constructor() {
14
14
  this.inputId = createID("DuetInput");
@@ -174,7 +174,7 @@ export class DuetNumberInput {
174
174
  this.handleChange = (ev) => {
175
175
  const input = ev.target;
176
176
  if (input && input.value) {
177
- let value = this.cleanValue(input.value);
177
+ let value = SafeParseFloat(input.value, this.locale);
178
178
  // Make sure that everything works if the user clears the input and
179
179
  // starts typing non-numeric characters.
180
180
  if (isNaN(value) || value == null) {
@@ -184,7 +184,7 @@ export class DuetNumberInput {
184
184
  this.duetInput.emit({
185
185
  component: "duet-number-input",
186
186
  originalEvent: ev,
187
- value: this.cleanValue(this.value).toString(),
187
+ value: SafeParseFloat(this.value, this.locale).toString(),
188
188
  valueAsNumber: value,
189
189
  });
190
190
  }
@@ -205,30 +205,29 @@ export class DuetNumberInput {
205
205
  if (input.value) {
206
206
  // On blur we want to make sure that the user input is between the min and max values,
207
207
  // and also round it up or down to the nearest step.
208
- let value = this.cleanValue(input.value);
208
+ let value = SafeParseFloat(input.value, this.locale);
209
209
  if (this.rounding) {
210
210
  value = roundTo(value, this.step);
211
211
  }
212
212
  value = clamp(value, this.min, this.max);
213
- if (value !== this.cleanValue(this.value) || value !== this.cleanValue(this.focusedValue)) {
213
+ if (value !== SafeParseFloat(this.value, this.locale) ||
214
+ value !== SafeParseFloat(this.focusedValue, this.locale)) {
214
215
  this.setValue(value);
215
216
  this.emitChange(ev);
216
217
  }
217
218
  }
218
- else {
219
- this.duetChange.emit({
220
- originalEvent: ev,
221
- value: null,
222
- valueAsNumber: null,
223
- component: "duet-number-input",
224
- });
225
- }
219
+ this.duetChange.emit({
220
+ originalEvent: ev,
221
+ value: null,
222
+ valueAsNumber: null,
223
+ component: "duet-number-input",
224
+ });
226
225
  };
227
226
  /**
228
227
  * Local methods.
229
228
  */
230
229
  this.emitChange = (ev) => {
231
- const currentValue = this.cleanValue(this.value);
230
+ const currentValue = SafeParseFloat(this.value, this.locale);
232
231
  this.duetChange.emit({
233
232
  originalEvent: ev,
234
233
  value: currentValue.toString(),
@@ -236,10 +235,6 @@ export class DuetNumberInput {
236
235
  component: "duet-number-input",
237
236
  });
238
237
  };
239
- this.cleanValue = (value) => {
240
- // Returns a number that can be used in calculations.
241
- return value ? parseLocaleFloat(value, this.locale) : null;
242
- };
243
238
  this.localizeValue = (value) => {
244
239
  // Returns a localized string that can be used as input value.
245
240
  return value.toLocaleString(this.locale);
@@ -256,13 +251,13 @@ export class DuetNumberInput {
256
251
  if (ev) {
257
252
  ev.preventDefault();
258
253
  }
259
- const currentValue = this.cleanValue(this.value);
254
+ const cleanedValue = SafeParseFloat(this.value, this.locale);
260
255
  // Only fire change event when necessary
261
- if (currentValue === this.max) {
256
+ if (cleanedValue === this.max) {
262
257
  return;
263
258
  }
264
259
  // in cases where no value set, incrementing should go to min
265
- let newValue = currentValue == null ? this.min : currentValue + this.step;
260
+ let newValue = cleanedValue == null ? this.min : cleanedValue + this.step;
266
261
  // handle cases where value is not multiple of step
267
262
  // e.g. if someone enters 199, with a step of 100, add should go to 200
268
263
  // and if someone enters 101, add should also go to 200
@@ -270,8 +265,8 @@ export class DuetNumberInput {
270
265
  const adjustment = newValue % this.step;
271
266
  newValue -= adjustment;
272
267
  }
273
- newValue = clamp(newValue, this.min, this.max);
274
- this.value = this.localizeValue(newValue);
268
+ const clampedValue = clamp(newValue, this.min, this.max);
269
+ this.value = this.localizeValue(clampedValue);
275
270
  this.emitChange(ev);
276
271
  };
277
272
  this.subtract = (ev) => {
@@ -280,7 +275,7 @@ export class DuetNumberInput {
280
275
  if (ev) {
281
276
  ev.preventDefault();
282
277
  }
283
- const currentValue = this.cleanValue(this.value);
278
+ const currentValue = SafeParseFloat(this.value, this.locale);
284
279
  // Only fire change event when necessary.
285
280
  if (currentValue === this.min) {
286
281
  return;
@@ -305,7 +300,7 @@ export class DuetNumberInput {
305
300
  inheritGlobalTheme(this);
306
301
  // Format the number value to a localeString initially.
307
302
  if (this.value) {
308
- this.value = this.localizeValue(parseLocaleFloat(this.value, this.locale));
303
+ this.value = this.localizeValue(SafeParseFloat(this.value, this.locale));
309
304
  }
310
305
  }
311
306
  /**
@@ -320,7 +315,7 @@ export class DuetNumberInput {
320
315
  this.duetInputElement.value = "";
321
316
  }
322
317
  formatAnnouncement() {
323
- const current = this.cleanValue(this.value);
318
+ const current = SafeParseFloat(this.value, this.locale);
324
319
  if (current == null) {
325
320
  return "";
326
321
  }
@@ -333,7 +328,7 @@ export class DuetNumberInput {
333
328
  render() {
334
329
  const identifier = this.identifier || this.inputId;
335
330
  const maxlength = `${this.localizeValue(this.max)} ${this.unit}`.length;
336
- const cleanedValue = this.cleanValue(this.value);
331
+ const cleanedValue = SafeParseFloat(this.value, this.locale);
337
332
  return (h(Host, { class: {
338
333
  "duet-theme-turva": this.theme === "turva",
339
334
  "duet-expand": this.expand,
@@ -130,6 +130,7 @@ export class DuetPagination {
130
130
  await this.setFocus();
131
131
  }
132
132
  }
133
+ return true;
133
134
  };
134
135
  //helper to emit relevant page events
135
136
  this.emitPageEvent = debounce((ev, passedPage) => {
@@ -143,7 +144,7 @@ export class DuetPagination {
143
144
  type: "page",
144
145
  originalEvent: ev,
145
146
  });
146
- }, 500);
147
+ }, 100);
147
148
  // this will return the entered number, or the current page if the user presses enter
148
149
  this.getEnteredNumber = debounce(ev => {
149
150
  this.emitPageEvent(ev, this.numbersStore);
@@ -161,7 +162,7 @@ export class DuetPagination {
161
162
  }, 500);
162
163
  }
163
164
  watchStateHandler(newValue, oldValue) {
164
- this.actionChain(newValue, oldValue);
165
+ return this.actionChain(newValue, oldValue);
165
166
  }
166
167
  /**
167
168
  * Component lifecycle events.
@@ -189,6 +190,7 @@ export class DuetPagination {
189
190
  e.preventDefault();
190
191
  e.stopPropagation();
191
192
  this.current = this.current + dir;
193
+ this.emitPageEvent(e);
192
194
  }
193
195
  //handle a11y keyboard navigation events
194
196
  async onKeyboardDown(e) {
@@ -231,8 +233,9 @@ export class DuetPagination {
231
233
  sectionClickHandler(e, direction) {
232
234
  e.preventDefault();
233
235
  let next = this.internalSectionIndex + direction;
234
- if (next >= this.totalPages / this.take) {
235
- next = this.totalPages / this.take - 1;
236
+ const takePerVisibleItems = this.take * this.visibleItems;
237
+ if (next * takePerVisibleItems > this.total) {
238
+ next = this.internalSectionIndex;
236
239
  }
237
240
  const newSection = next;
238
241
  this.internalSectionIndex = newSection >= 0 ? newSection : 0;
@@ -242,12 +245,14 @@ export class DuetPagination {
242
245
  e.preventDefault();
243
246
  this.internalSectionIndex = 0;
244
247
  this.current = 1;
248
+ this.emitPageEvent(e);
245
249
  }
246
250
  //handles click on the jump (total) button
247
251
  jumpToEnd(e) {
248
252
  e.preventDefault();
249
- this.internalSectionIndex = this.totalPages / this.take - 1;
253
+ this.internalSectionIndex = Math.ceil(this.totalPages / this.take - 1);
250
254
  this.current = this.totalPages;
255
+ this.emitPageEvent(e);
251
256
  }
252
257
  // render the individual page numbers
253
258
  renderPageNumbers() {
@@ -300,18 +305,18 @@ export class DuetPagination {
300
305
  h("duet-action-button", { disabled: this.internalSectionIndex === 0 && this.current <= 1, "data-direction": "back", onClick: e => this.onMouseHandler(e, -1), "aria-label": this.accessibleLabels.previous_page, "icon-name": "action-arrow-left-small" })),
301
306
  this.internalSectionIndex !== 0 && this.shouldDisplayNavigation() && (h(Fragment, null,
302
307
  h("li", { class: "duet-pagination-item", role: "menuitem", part: "navigation-jump" },
303
- h("duet-button", { class: "duet-pagination-link", "center-text": "true", variation: "plain", color: "secondary", margin: "none", accessibleLabel: this.accessibleLabels.first_page, onClick: e => this.jumpToStart(e) },
308
+ h("duet-button", { class: "duet-pagination-link duet-pagination-link-jump-back", "center-text": "true", variation: "plain", color: "secondary", margin: "none", accessibleLabel: this.accessibleLabels.first_page, onClick: e => this.jumpToStart(e) },
304
309
  h("div", { class: "duet-pagination-page-number" }, "1"))),
305
310
  h("li", { class: "duet-pagination-item", role: "menuitem", part: "navigation-section" },
306
- h("duet-button", { class: "duet-pagination-link", "center-text": "true", color: "secondary", variation: "plain", margin: "none", accessibleLabel: this.accessibleLabels.prev_section.replace("{0}", `${this.visibleItems}`), onClick: e => this.sectionClickHandler(e, -1) },
311
+ h("duet-button", { class: "duet-pagination-link duet-pagination-link-dots-back", "center-text": "true", color: "secondary", variation: "plain", margin: "none", accessibleLabel: this.accessibleLabels.prev_section.replace("{0}", `${this.visibleItems}`), onClick: e => this.sectionClickHandler(e, -1) },
307
312
  h("div", { class: "duet-pagination-page-number", "aria-hidden": "true" }, "..."))))),
308
313
  this.renderPageNumbers(),
309
- this.internalSectionIndex !== this.totalPages / this.visibleItems - 1 && this.shouldDisplayNavigation() && (h(Fragment, null,
314
+ this.internalSectionIndex * (this.visibleItems + 2) < this.totalPages && this.shouldDisplayNavigation() && (h(Fragment, null,
310
315
  h("li", { class: "duet-pagination-item", role: "menuitem", part: "navigation-section" },
311
- h("duet-button", { class: "duet-pagination-link", "center-text": "true", color: "secondary", variation: "plain", margin: "none", accessibleLabel: this.accessibleLabels.next_section.replace("{0}", `${this.visibleItems}`), onClick: e => this.sectionClickHandler(e, 1) },
316
+ h("duet-button", { class: "duet-pagination-link duet-pagination-link-dots-forward", "center-text": "true", color: "secondary", variation: "plain", margin: "none", accessibleLabel: this.accessibleLabels.next_section.replace("{0}", `${this.visibleItems}`), onClick: e => this.sectionClickHandler(e, 1) },
312
317
  h("div", { class: "duet-pagination-page-number", "aria-hidden": "true" }, "..."))),
313
318
  h("li", { class: "duet-pagination-item", role: "menuitem", part: "navigation-jump" },
314
- h("duet-button", { class: "duet-pagination-link", "center-text": "true", color: "secondary", variation: "plain", margin: "none", accessibleLabel: this.accessibleLabels.last_page, onClick: e => this.jumpToEnd(e) },
319
+ h("duet-button", { class: "duet-pagination-link duet-pagination-link-jump-forward", "center-text": "true", color: "secondary", variation: "plain", margin: "none", accessibleLabel: this.accessibleLabels.last_page, onClick: e => this.jumpToEnd(e) },
315
320
  h("div", { class: "duet-pagination-page-number" }, this.totalPages))))),
316
321
  h("li", { class: {
317
322
  "duet-pagination-page-button": true,
@@ -507,7 +512,7 @@ export class DuetPagination {
507
512
  },
508
513
  "take": {
509
514
  "type": "number",
510
- "mutable": true,
515
+ "mutable": false,
511
516
  "complexType": {
512
517
  "original": "number",
513
518
  "resolved": "number",
@@ -525,7 +530,7 @@ export class DuetPagination {
525
530
  },
526
531
  "visibleItems": {
527
532
  "type": "number",
528
- "mutable": true,
533
+ "mutable": false,
529
534
  "complexType": {
530
535
  "original": "number",
531
536
  "resolved": "number",
@@ -543,7 +548,7 @@ export class DuetPagination {
543
548
  },
544
549
  "total": {
545
550
  "type": "number",
546
- "mutable": true,
551
+ "mutable": false,
547
552
  "complexType": {
548
553
  "original": "number",
549
554
  "resolved": "number",
@@ -63,15 +63,15 @@ export class DuetRangeStepper {
63
63
  this.handleStepClick(e);
64
64
  };
65
65
  }
66
- watchStateHandler(newValue) {
67
- if (newValue === 1) {
66
+ watchStepIndexStateHandler(newValue) {
67
+ if (newValue <= 1) {
68
68
  this.leftBnRef.setAttribute("disabled", "");
69
69
  this.rightBnRef.focus();
70
70
  }
71
71
  else {
72
72
  this.leftBnRef.removeAttribute("disabled");
73
73
  }
74
- if (newValue === this.total / this.stepSize) {
74
+ if (newValue >= this.total / this.stepSize) {
75
75
  this.rightBnRef.setAttribute("disabled", "");
76
76
  this.leftBnRef.focus();
77
77
  }
@@ -79,12 +79,20 @@ export class DuetRangeStepper {
79
79
  this.rightBnRef.removeAttribute("disabled");
80
80
  }
81
81
  }
82
+ watchStepSizeStateHandler(newValue, oldValue) {
83
+ if (newValue !== oldValue) {
84
+ if (this.stepIndex * newValue > this.total) {
85
+ this.stepIndex = this.total / newValue;
86
+ }
87
+ }
88
+ }
82
89
  handleStepClick(e) {
90
+ const from = this.stepIndex * this.stepSize - this.stepSize;
83
91
  this.duetRangeStepUpdate.emit({
84
92
  originalEvent: e,
85
93
  component: "duet-range-stepper",
86
- from: this.stepIndex * this.stepSize - this.stepSize,
87
- to: this.stepIndex * this.stepSize,
94
+ from: from,
95
+ to: this.getTo(),
88
96
  index: this.stepIndex,
89
97
  });
90
98
  }
@@ -92,7 +100,7 @@ export class DuetRangeStepper {
92
100
  inheritGlobalTheme(this);
93
101
  }
94
102
  componentDidLoad() {
95
- this.watchStateHandler(this.stepIndex);
103
+ this.watchStepIndexStateHandler(this.stepIndex);
96
104
  }
97
105
  increment(direction) {
98
106
  const newIndex = this.stepIndex + direction;
@@ -100,22 +108,28 @@ export class DuetRangeStepper {
100
108
  this.stepIndex = 1;
101
109
  }
102
110
  else {
103
- if (newIndex * this.stepSize <= this.total) {
111
+ if (newIndex * this.stepSize < this.total + this.stepSize) {
104
112
  this.stepIndex = newIndex;
105
113
  }
106
- else {
114
+ else if (newIndex * this.stepSize > this.total + this.stepSize) {
115
+ this.stepIndex = Math.floor(this.total / this.stepSize);
107
116
  }
108
117
  }
109
118
  }
119
+ getTo() {
120
+ const to = this.stepIndex * this.stepSize;
121
+ const result = to > this.total ? this.total : to;
122
+ return result;
123
+ }
110
124
  generateStepSize() {
111
125
  // this function uses this.stepIndex and this.range to generate a range of number like 1-100
112
126
  // this is used to generate the step size
113
- let start = (this.stepIndex - 1) * this.stepSize;
127
+ let start = Math.floor((this.stepIndex - 1) * this.stepSize);
114
128
  //easy fix for starting position
115
129
  if (start === 0) {
116
130
  start = 1;
117
131
  }
118
- const end = this.stepIndex * this.stepSize;
132
+ const end = Math.floor(this.stepIndex * this.stepSize);
119
133
  return this.ariaLabels.x_of_y
120
134
  .replace("{0}", String(start))
121
135
  .replace("{1}", String(end))
@@ -335,6 +349,9 @@ export class DuetRangeStepper {
335
349
  static get elementRef() { return "element"; }
336
350
  static get watchers() { return [{
337
351
  "propName": "stepIndex",
338
- "methodName": "watchStateHandler"
352
+ "methodName": "watchStepIndexStateHandler"
353
+ }, {
354
+ "propName": "stepSize",
355
+ "methodName": "watchStepSizeStateHandler"
339
356
  }]; }
340
357
  }
@@ -71,15 +71,14 @@ duet-table .duet-table-action-row td:last-child {
71
71
  white-space: nowrap;
72
72
  }
73
73
 
74
- .duet-table-flattened tbody tr {
75
- display: grid;
76
- grid-template-columns: repeat(2, 1fr);
77
- grid-auto-rows: auto;
78
- gap: 10px;
79
- }
80
- .duet-table-flattened tbody tr.duet-table-action-row td:last-child::before {
81
- padding: 0;
82
- content: "";
74
+ .duet-table-flattened table,
75
+ .duet-table-flattened thead,
76
+ .duet-table-flattened tbody,
77
+ .duet-table-flattened tfoot,
78
+ .duet-table-flattened th,
79
+ .duet-table-flattened td,
80
+ .duet-table-flattened tr {
81
+ display: block;
83
82
  }
84
83
  .duet-table-flattened thead tr {
85
84
  position: absolute !important;
@@ -92,20 +91,11 @@ duet-table .duet-table-action-row td:last-child {
92
91
  border: 0 !important;
93
92
  }
94
93
  .duet-table-flattened td {
95
- grid-column: 1/2;
96
94
  line-height: 1.25;
97
95
  }
98
96
  .duet-table-flattened td:not(:last-child) {
99
97
  margin-bottom: 16px !important;
100
98
  }
101
- .duet-table-flattened td:first-child {
102
- grid-row: 1;
103
- grid-column: 1;
104
- }
105
- .duet-table-flattened td:last-child {
106
- grid-row: 1;
107
- grid-column: 2;
108
- }
109
99
  .duet-table-flattened tbody td,
110
100
  .duet-table-flattened tbody th,
111
101
  .duet-table-flattened tfoot td {
@@ -337,4 +327,26 @@ duet-table .duet-table-action-row td:last-child {
337
327
  .duet-table-actions thead th:last-child {
338
328
  width: 1px;
339
329
  white-space: nowrap;
330
+ }
331
+
332
+ .duet-editable-table-table.duet-table-flattened tr {
333
+ display: grid;
334
+ grid-template-columns: repeat(2, 1fr);
335
+ grid-auto-rows: auto;
336
+ gap: 10px;
337
+ }
338
+ .duet-editable-table-table.duet-table-flattened tr.duet-table-action-row td:last-child::before {
339
+ padding: 0;
340
+ content: "";
341
+ }
342
+ .duet-editable-table-table.duet-table-flattened td {
343
+ grid-column: 1/2;
344
+ }
345
+ .duet-editable-table-table.duet-table-flattened td:first-child {
346
+ grid-row: 1;
347
+ grid-column: 1;
348
+ }
349
+ .duet-editable-table-table.duet-table-flattened td:last-child {
350
+ grid-row: 1;
351
+ grid-column: 2;
340
352
  }
@@ -0,0 +1,76 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ /**
5
+ * function that takes a string value or number and looks for any character resembling a minus,
6
+ * it will then replace it with a hypen-minus and return the parseFloat value of that string
7
+ * it will string / number cast the value to a number and return that number
8
+ * known issues: if a negative number is indicated with other characters than a "minus like" character, it will throw
9
+ * - an example is that some locales use (number) as an indicator for negative values instead of -number
10
+ */
11
+ export function SafeParseFloat(value, locale) {
12
+ let results;
13
+ if (typeof value === "string") {
14
+ //the minuses are NOT the same characters, they differ in unicode for some languages
15
+ // "‐", "−", "–", and "—"
16
+ let convertedMinus = value.replace("−", "-").replace("‐", "-").replace("−", "-").replace("–", "-").replace("—", "-");
17
+ if (locale) {
18
+ convertedMinus = ConvertToEnUS(convertedMinus, locale, false);
19
+ }
20
+ // replace all possible spaces from the string
21
+ convertedMinus = convertedMinus.replace(/\s+/g, "");
22
+ convertedMinus = convertedMinus.replace(/(?!^-?\d*\.{0,1}\d+$)/g, "");
23
+ /*
24
+ example: https://regex101.com/r/np7FqS/1
25
+ /(?!^-?\d*\.{0,1}\d+$)/g
26
+ Negative Lookahead (?!^-?\d*\.{0,1}\d+$)
27
+ Assert that the Regex below does not match
28
+ ^ asserts position at start of a line
29
+ - matches the character - with index 4510 (2D16 or 558) literally (case sensitive)
30
+ ? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
31
+ \d matches a digit (equivalent to [0-9])
32
+ * matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
33
+ \. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
34
+ {0,1} matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
35
+ \d matches a digit (equivalent to [0-9])
36
+ + matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
37
+ $ asserts position at the end of a line
38
+ Global pattern flags
39
+ g modifier: global. All matches (don't return after first match)
40
+ m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
41
+ */
42
+ results = parseFloat(convertedMinus);
43
+ }
44
+ if (typeof value === "number") {
45
+ results = parseFloat(String(value));
46
+ }
47
+ if (!isNaN(Number(results))) {
48
+ return Number(results);
49
+ }
50
+ if (value === null || value === undefined) {
51
+ return null;
52
+ }
53
+ throw new Error("Invalid value passed to SafeParseFloat");
54
+ }
55
+ // string conversion function that takes a locale and coverts decimal indicator to en-US indicator
56
+ // and takes the thousand separator for the given locale and transforms that to the en-US separator
57
+ export function ConvertToEnUS(value, locale, replaceThousands = false) {
58
+ let replacedValue;
59
+ const localeSeparator = new Intl.NumberFormat(locale).format(1 / 2).replace(/[0-9]/g, "");
60
+ const enUSSeparator = new Intl.NumberFormat("en-US").format(1 / 2).replace(/[0-9]/g, "");
61
+ const thousandSeparator = new Intl.NumberFormat(locale).format(1000).replace(/[0-9]/g, "");
62
+ const enUSThousandSeparator = new Intl.NumberFormat("en-US").format(1000).replace(/[0-9]/g, "");
63
+ // double conversions to avoid ,->. and .->, at the same time resulting in a double conversion
64
+ replacedValue = value.replace(localeSeparator, "DECIMALSEPARATOR");
65
+ if (replaceThousands) {
66
+ replacedValue = replacedValue.replace(thousandSeparator, "THOUSANDSEPARATOR");
67
+ }
68
+ else {
69
+ replacedValue = replacedValue.replace(thousandSeparator, "");
70
+ }
71
+ replacedValue = replacedValue.replace("DECIMALSEPARATOR", enUSSeparator);
72
+ replacedValue = replacedValue.replace("THOUSANDSEPARATOR", enUSThousandSeparator);
73
+ return replacedValue;
74
+ }
75
+ export const roundTo = (val, multiple) => Math.round(val / multiple) * multiple;
76
+ export const clamp = (val, min, max) => Math.min(Math.max(val, min), max);