@oliasoft-open-source/react-ui-library 4.7.0-beta-1 → 4.7.0-beta-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 (219) hide show
  1. package/README.md +12 -11
  2. package/dist/assets/{index-AkeNwthw.css → index-dOfLgtRX.css} +226 -183
  3. package/dist/assets/{index-neKlYvgy.js → index-ffnttoim.js} +285 -147
  4. package/dist/global.css +226 -183
  5. package/dist/index.d.ts +132 -22
  6. package/dist/index.html +1 -1
  7. package/dist/index.js +754 -391
  8. package/dist/index.js.map +1 -1
  9. package/dist/storybook/assets/Color-6VNJS4EI-5mv-gOfo.js +1 -0
  10. package/dist/storybook/assets/DocsRenderer-NNNQARDV-WaSwS_18.js +1 -0
  11. package/dist/storybook/assets/WithTooltip-V3YHNWJZ-Dlt0G_eH.js +1 -0
  12. package/dist/storybook/assets/{accordion-6_27SROY.js → accordion-M-sY23Hd.js} +1 -1
  13. package/dist/storybook/assets/{accordion.stories-Uipdifbl.js → accordion.stories-BbpRXaiJ.js} +2 -2
  14. package/dist/storybook/assets/actions-MkrpU3sl.js +1 -0
  15. package/dist/storybook/assets/actions-_FIB7bOt.css +1 -0
  16. package/dist/storybook/assets/actions.stories-9i52_Rux.js +1 -0
  17. package/dist/storybook/assets/afe.stories-U0-W5U64.js +88 -0
  18. package/dist/storybook/assets/badge.stories--T9ak5cr.js +1 -0
  19. package/dist/storybook/assets/blowout.stories-G-gAIxfk.js +40 -0
  20. package/dist/storybook/assets/button-MXXjI7Bb.js +1 -0
  21. package/dist/storybook/assets/{button-group-q8QKkLVU.js → button-group-f5VgIRsa.js} +1 -1
  22. package/dist/storybook/assets/{button-group.stories-tLZpLTfD.js → button-group.stories-C7TuTTy6.js} +2 -2
  23. package/dist/storybook/assets/button.stories-rq3SXBTn.js +80 -0
  24. package/dist/storybook/assets/{buttons-and-links-gkg6hOs-.js → buttons-and-links-VQgmPqVJ.js} +2 -2
  25. package/dist/storybook/assets/card.stories-pCYBc-Vt.js +1 -0
  26. package/dist/storybook/assets/casing-loads.stories-gq4jb1p0.js +209 -0
  27. package/dist/storybook/assets/cell.stories-ycwhWlIa.js +245 -0
  28. package/dist/storybook/assets/{check-box-LZdXXKhv.js → check-box-w174Mu0R.js} +1 -1
  29. package/dist/storybook/assets/{check-box.stories-0XCykxnz.js → check-box.stories-72A4TN39.js} +2 -2
  30. package/dist/storybook/assets/{chunk-HLWAVYOI-YF156CNQ.js → chunk-HLWAVYOI-_b1tlWM3.js} +1 -1
  31. package/dist/storybook/assets/color-cEzs-xnA.js +25 -0
  32. package/dist/storybook/assets/{column.stories-6OLsjlcP.js → column.stories-U4nQqgWb.js} +7 -7
  33. package/dist/storybook/assets/dialog-u5m1F-lX.js +1 -0
  34. package/dist/storybook/assets/{drawer-WuErQ5Z8.js → drawer-was2OGqf.js} +1 -1
  35. package/dist/storybook/assets/{drawer.stories-RFRPs_pQ.js → drawer.stories-euYpu-I_.js} +4 -4
  36. package/dist/storybook/assets/empty.stories-T-_CrIhL.js +1 -0
  37. package/dist/storybook/assets/entry-preview-TGgN7-T4.js +1 -0
  38. package/dist/storybook/assets/{config-b-_d5fwn.js → entry-preview-docs-KfUfHYQ7.js} +37 -37
  39. package/dist/storybook/assets/{field-eknsj_Ll.js → field-fx75Y95f.js} +1 -1
  40. package/dist/storybook/assets/{field.stories-RmhJ16HT.js → field.stories-2Qckj9Ou.js} +5 -5
  41. package/dist/storybook/assets/file-button.stories-0zVuRMcp.js +10 -0
  42. package/dist/storybook/assets/file-input-fzEQtraw.js +1 -0
  43. package/dist/storybook/assets/file-input.stories-P1T12gxg.js +66 -0
  44. package/dist/storybook/assets/{flex.stories-lLz0Xrt_.js → flex.stories-Vlk77f1V.js} +2 -2
  45. package/dist/storybook/assets/footer.stories-OOGCWJOv.js +3 -0
  46. package/dist/storybook/assets/form.stories-NIwGiDxn.js +49 -0
  47. package/dist/storybook/assets/formation.stories-1BHk-Z5n.js +74 -0
  48. package/dist/storybook/assets/{formatter-SWP5E3XI-uJi-Y6Jy.js → formatter-SWP5E3XI-lPjnxviv.js} +1 -1
  49. package/dist/storybook/assets/{heading-Bk0bpNfe.js → heading-CRsqGmBL.js} +1 -1
  50. package/dist/storybook/assets/{heading.stories-HLMPkIPo.js → heading.stories-i7xajcE_.js} +2 -2
  51. package/dist/storybook/assets/{help-icon--rUDxLUD.js → help-icon-DUhtRK0A.js} +1 -1
  52. package/dist/storybook/assets/help-icon.stories-FyPetqQr.js +4 -0
  53. package/dist/storybook/assets/icon-8EQazuuW.js +8 -0
  54. package/dist/storybook/assets/icon.stories-j-b_Exev.js +6 -0
  55. package/dist/storybook/assets/iframe-7Gvk33Dy.js +7 -0
  56. package/dist/storybook/assets/index-PPLHz8o0.js +6 -0
  57. package/dist/storybook/assets/index-R5dkQuFe.js +3 -0
  58. package/dist/storybook/assets/index-VSx05S_2.js +14 -0
  59. package/dist/storybook/assets/{index-_waogfzH.js → index-xs8f072L.js} +20 -20
  60. package/dist/storybook/assets/index.es-VXFRDikp.js +79 -0
  61. package/dist/storybook/assets/inheritsLoose-8sb_A2v4.js +1 -0
  62. package/dist/storybook/assets/{input-group.stories-WljyIQ0a.js → input-group.stories-6EUjHyss.js} +5 -5
  63. package/dist/storybook/assets/{input-validation-XFS-LWhH.js → input-validation-fn2c7CZI.js} +2 -2
  64. package/dist/storybook/assets/{input-u1He-wWs.js → input-vzl5J-q1.js} +1 -1
  65. package/dist/storybook/assets/{input.stories-rLdDRxtU.js → input.stories-rTyGPzfX.js} +1 -1
  66. package/dist/storybook/assets/{inputs-vo_nTpyh.js → inputs-4CE3Qz8f.js} +14 -14
  67. package/dist/storybook/assets/{isPlainObject-4RuU_w9g.js → isPlainObject-OQlD0fAV.js} +1 -1
  68. package/dist/storybook/assets/{label-0_Qf6I8t.js → label-CezqEpI3.js} +1 -1
  69. package/dist/storybook/assets/label.stories-niFJlzWW.js +11 -0
  70. package/dist/storybook/assets/layout-forms-hnqEzhUh.js +16 -0
  71. package/dist/storybook/assets/{layout-general-QgIJDQ4H.js → layout-general-GKzWTVlq.js} +2 -2
  72. package/dist/storybook/assets/list-obj4NAnI.js +8 -0
  73. package/dist/storybook/assets/{list.stories-data-IcFu6vvd.js → list.stories-data-xxLjz2Y6.js} +1 -1
  74. package/dist/storybook/assets/list.stories-q5ZUuhM_.js +478 -0
  75. package/dist/storybook/assets/{loader.stories-0OwmnNML.js → loader.stories-UWhF9bJF.js} +5 -5
  76. package/dist/storybook/assets/menu.stories-y0NlwAvu.js +82 -0
  77. package/dist/storybook/assets/{message-uMHaTEXV.js → message-CRKuTfOl.js} +1 -1
  78. package/dist/storybook/assets/{message.stories-CDgUaLZP.js → message.stories-iT_DKpjU.js} +2 -2
  79. package/dist/storybook/assets/meta-content-dR7AAq04.css +1 -0
  80. package/dist/storybook/assets/meta-content-egPJiNdW.js +1 -0
  81. package/dist/storybook/assets/modal.stories-VOY0gBdV.js +200 -0
  82. package/dist/storybook/assets/number-input-yoDwXp2C.js +1 -0
  83. package/dist/storybook/assets/number-input.stories-QRbtwUKs.js +153 -0
  84. package/dist/storybook/assets/objectWithoutPropertiesLoose-9Q1jwsKS.js +1 -0
  85. package/dist/storybook/assets/option-dropdown.stories-hrDlMrbm.js +21 -0
  86. package/dist/storybook/assets/{padding-and-spacing-J_Zb8SJm.js → padding-and-spacing-J0l6qP8c.js} +1 -1
  87. package/dist/storybook/assets/page.stories--jUrPw0e.js +57 -0
  88. package/dist/storybook/assets/{pagination-5n5spTRo.js → pagination-APbPWlVY.js} +1 -1
  89. package/dist/storybook/assets/{pagination.stories-g4a-aSxq.js → pagination.stories-r3XGZlP9.js} +1 -1
  90. package/dist/storybook/assets/pop-confirm.stories-pXKS5ukj.js +9 -0
  91. package/dist/storybook/assets/popover-ZJGe9jlj.js +1 -0
  92. package/dist/storybook/assets/popover.stories-2K90u4uo.js +10 -0
  93. package/dist/storybook/assets/{portal.stories-UGkzdgVk.js → portal.stories-1Jnj3LXz.js} +1 -1
  94. package/dist/storybook/assets/preview-BYvKcpdH.js +7 -0
  95. package/dist/storybook/assets/preview-OnO0tzRj.js +17 -0
  96. package/dist/storybook/assets/{preview-WIFbPoA-.js → preview-vq7_vD2k.js} +13 -13
  97. package/dist/storybook/assets/projects.stories-LB28sKC4.js +47 -0
  98. package/dist/storybook/assets/{radio-button-jHcwHUA4.js → radio-button-9Xi1TwWI.js} +1 -1
  99. package/dist/storybook/assets/{radio-button.stories-LkCJsp5P.js → radio-button.stories-7dkCcpUZ.js} +5 -5
  100. package/dist/storybook/assets/react-router-dom-EZH1n7K1.js +8 -0
  101. package/dist/storybook/assets/{reservoirs.stories-hhPblhmv.js → reservoirs.stories-f7usYIda.js} +2 -2
  102. package/dist/storybook/assets/{rich-text-input.stories-7UzvJ-A1.js → rich-text-input.stories-YWaiFQEd.js} +1 -1
  103. package/dist/storybook/assets/row.stories-wtewEk0Z.js +130 -0
  104. package/dist/storybook/assets/select-Bp8YY8Ze.js +1 -0
  105. package/dist/storybook/assets/{select.stories-qFDyxRFm.js → select.stories-RjqGVn2g.js} +1 -1
  106. package/dist/storybook/assets/side-bar-V0uxIghC.js +1 -0
  107. package/dist/storybook/assets/side-bar.stories-rKoL8lrf.js +1 -0
  108. package/dist/storybook/assets/{site.stories-QHCzFOnt.js → site.stories-nwcDZZdB.js} +2 -2
  109. package/dist/storybook/assets/slider-0HIxE6AZ.js +7 -0
  110. package/dist/storybook/assets/slider.stories-9wM3WmDC.js +171 -0
  111. package/dist/storybook/assets/smart-upload-modal.stories-Lqh7FFLe.js +25 -0
  112. package/dist/storybook/assets/spacer.stories-4n4RL13L.js +1 -0
  113. package/dist/storybook/assets/syntaxhighlighter-B5GMVT5T-jJ-aXkjr.js +1 -0
  114. package/dist/storybook/assets/table-smKT-hbF.css +1 -0
  115. package/dist/storybook/assets/table-tDId3FKL.js +1 -0
  116. package/dist/storybook/assets/{table.stories-tEvulp9K.js → table.stories-N07QxfiK.js} +94 -18
  117. package/dist/storybook/assets/table.stories-data-6LXl4zwR.js +1 -0
  118. package/dist/storybook/assets/{tabs.stories-KtJc5Yci.js → tabs.stories-aps5NXFv.js} +2 -2
  119. package/dist/storybook/assets/text-link.stories-Mx9ojcOC.js +14 -0
  120. package/dist/storybook/assets/{textarea-gxvxVBdC.js → textarea-c5fYK9-8.js} +1 -1
  121. package/dist/storybook/assets/{textarea.stories-MZHVAwSx.js → textarea.stories-soUP2Yhm.js} +1 -1
  122. package/dist/storybook/assets/tiny-invariant-R4kOKlvx.js +8 -0
  123. package/dist/storybook/assets/title.stories-MKmiziEV.js +37 -0
  124. package/dist/storybook/assets/{toaster-eOozfa7U.js → toaster-yPcd4ELJ.js} +1 -1
  125. package/dist/storybook/assets/toaster.stories-Na9wGy65.js +86 -0
  126. package/dist/storybook/assets/{toggle-BPI2y-lU.js → toggle-gxvny8zu.js} +1 -1
  127. package/dist/storybook/assets/{toggle.stories-aVmjpons.js → toggle.stories-_Qd5Xk1K.js} +2 -2
  128. package/dist/storybook/assets/{tooltip-HEHiU__l.js → tooltip-pjcB4ZxN.js} +2 -2
  129. package/dist/storybook/assets/{tooltip.stories-tiOgoWHH.js → tooltip.stories-YJfYxnb3.js} +1 -1
  130. package/dist/storybook/assets/tooltip.test-case.stories-ZUrHDklJ.js +5 -0
  131. package/dist/storybook/assets/top-bar--h98E6oo.js +1 -0
  132. package/dist/storybook/assets/top-bar-K-LdFikH.css +1 -0
  133. package/dist/storybook/assets/top-bar.stories-eahNLSjM.js +21 -0
  134. package/dist/storybook/assets/top-bar.testcase.stories-AbbFHB0-.js +30 -0
  135. package/dist/storybook/assets/tree-U4LtpVm9.css +1 -0
  136. package/dist/storybook/assets/tree.stories-JyczIgiP.js +182 -0
  137. package/dist/storybook/assets/unit-input-OT-AqIIa.css +1 -0
  138. package/dist/storybook/assets/unit-input.stories-diwgawFe.js +349 -0
  139. package/dist/storybook/assets/unit-table.stories-6agZ80lN.js +150 -0
  140. package/dist/storybook/iframe.html +3 -1
  141. package/dist/storybook/index.json +1 -1
  142. package/dist/storybook/project.json +1 -1
  143. package/dist/storybook/sb-addons/actions-0/manager-bundle.js +1 -1
  144. package/dist/storybook/sb-preview/globals.js +1 -1
  145. package/dist/storybook/sb-preview/runtime.js +19 -19
  146. package/dist/storybook/stories.json +1 -1
  147. package/package.json +10 -9
  148. package/dist/storybook/assets/Color-6VNJS4EI-NPUHt_3q.js +0 -1
  149. package/dist/storybook/assets/DocsRenderer-NNNQARDV-HIEKjKKN.js +0 -1
  150. package/dist/storybook/assets/WithTooltip-4HIR6TLV-XVy3Qn7b.js +0 -1
  151. package/dist/storybook/assets/actions-W12osUP0.css +0 -1
  152. package/dist/storybook/assets/actions-Z9jDWreP.js +0 -1
  153. package/dist/storybook/assets/actions.stories-Qrio9EMy.js +0 -1
  154. package/dist/storybook/assets/afe.stories-mangk6LB.js +0 -88
  155. package/dist/storybook/assets/badge.stories-C0MXS15j.js +0 -1
  156. package/dist/storybook/assets/blowout.stories-i7Ii3760.js +0 -40
  157. package/dist/storybook/assets/button-7V8oA22w.js +0 -1
  158. package/dist/storybook/assets/button.stories-PhWmZXOu.js +0 -71
  159. package/dist/storybook/assets/card.stories-HzHJW6ek.js +0 -1
  160. package/dist/storybook/assets/casing-loads.stories-4eIPrrhL.js +0 -209
  161. package/dist/storybook/assets/cell.stories-X4sboJCw.js +0 -212
  162. package/dist/storybook/assets/color-PIYd2VAw.js +0 -25
  163. package/dist/storybook/assets/dialog-WKHRZcjc.js +0 -1
  164. package/dist/storybook/assets/empty.stories-lva3DbfI.js +0 -1
  165. package/dist/storybook/assets/extends-dGVwEr9R.js +0 -1
  166. package/dist/storybook/assets/file-input.stories-SF8BeFpu.js +0 -66
  167. package/dist/storybook/assets/footer.stories-L0qQuABW.js +0 -3
  168. package/dist/storybook/assets/form.stories-qQsjBbOk.js +0 -49
  169. package/dist/storybook/assets/formation.stories-E8DV_cIY.js +0 -74
  170. package/dist/storybook/assets/help-icon.stories-vifwJgNA.js +0 -4
  171. package/dist/storybook/assets/icon-y1a2N5SZ.js +0 -8
  172. package/dist/storybook/assets/icon.stories-W-UgTWyK.js +0 -6
  173. package/dist/storybook/assets/iframe-NU_z28D3.js +0 -7
  174. package/dist/storybook/assets/index-IQMsp8Ab.js +0 -14
  175. package/dist/storybook/assets/index-gM75B7fB.js +0 -8
  176. package/dist/storybook/assets/index.es-JXn3JM7k.js +0 -86
  177. package/dist/storybook/assets/inheritsLoose-Y9jOMJLd.js +0 -1
  178. package/dist/storybook/assets/label.stories-aXdU5_Ql.js +0 -11
  179. package/dist/storybook/assets/layout-forms-w8JJQQqh.js +0 -16
  180. package/dist/storybook/assets/list-8l-RGDgw.js +0 -8
  181. package/dist/storybook/assets/list-heading-Vd3hu5Pf.js +0 -1
  182. package/dist/storybook/assets/list-heading-Y8BAUuV6.css +0 -1
  183. package/dist/storybook/assets/list.stories-Vp0Dm7UU.js +0 -457
  184. package/dist/storybook/assets/menu.stories-VwRF_Pbx.js +0 -60
  185. package/dist/storybook/assets/modal.stories-15sY1c5H.js +0 -173
  186. package/dist/storybook/assets/number-input-SvjJIGsW.js +0 -1
  187. package/dist/storybook/assets/number-input.stories-BURENIFo.js +0 -81
  188. package/dist/storybook/assets/option-dropdown.stories-Q2zd2AcS.js +0 -21
  189. package/dist/storybook/assets/page.stories-pa-9WU0e.js +0 -57
  190. package/dist/storybook/assets/pop-confirm.stories-_agvSFJd.js +0 -9
  191. package/dist/storybook/assets/popover-Y3FpGdUS.js +0 -1
  192. package/dist/storybook/assets/popover.stories-b7Tt4S0j.js +0 -1
  193. package/dist/storybook/assets/preview-D7BEK6_6.js +0 -7
  194. package/dist/storybook/assets/preview-Fi7DQdoQ.js +0 -1
  195. package/dist/storybook/assets/projects.stories-YPlCLdRE.js +0 -47
  196. package/dist/storybook/assets/row.stories-juQv80h3.js +0 -122
  197. package/dist/storybook/assets/select-JjEPivho.js +0 -1
  198. package/dist/storybook/assets/side-bar-Fjr2t9MT.js +0 -1
  199. package/dist/storybook/assets/side-bar.stories-sxBJCVnV.js +0 -1
  200. package/dist/storybook/assets/slider-nl2rJ9LF.js +0 -7
  201. package/dist/storybook/assets/slider.stories--aZa8kf-.js +0 -127
  202. package/dist/storybook/assets/spacer.stories-eCrKj4b3.js +0 -1
  203. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI--OA96ou_.js +0 -1
  204. package/dist/storybook/assets/table-PWodWi0p.css +0 -1
  205. package/dist/storybook/assets/table-i8WT9qpj.js +0 -1
  206. package/dist/storybook/assets/table.stories-data-4h6h0P0V.js +0 -1
  207. package/dist/storybook/assets/text-link.stories-kjfUeFtk.js +0 -1
  208. package/dist/storybook/assets/title.stories-cmteB9lx.js +0 -37
  209. package/dist/storybook/assets/toaster.stories-S25S4g_F.js +0 -86
  210. package/dist/storybook/assets/tooltip.test-case.stories-kIeZayHw.js +0 -3
  211. package/dist/storybook/assets/top-bar-9iOkm7Gq.js +0 -1
  212. package/dist/storybook/assets/top-bar-cBtxm6yr.css +0 -1
  213. package/dist/storybook/assets/top-bar.stories-5jcHi3Q_.js +0 -1
  214. package/dist/storybook/assets/top-bar.testcase.stories-7acJvLc_.js +0 -30
  215. package/dist/storybook/assets/tree-zmq4MRb6.css +0 -1
  216. package/dist/storybook/assets/tree.stories-_5t-Rrls.js +0 -128
  217. package/dist/storybook/assets/unit-input-qBUtqoTb.css +0 -1
  218. package/dist/storybook/assets/unit-input.stories-j3Ykteob.js +0 -273
  219. package/dist/storybook/assets/unit-table.stories-4XYwgJwY.js +0 -100
package/dist/index.js CHANGED
@@ -10,9 +10,8 @@ import React__default, { useContext, isValidElement, useState, useRef, useEffect
10
10
  import * as PropTypes from "prop-types";
11
11
  import PropTypes__default from "prop-types";
12
12
  import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
13
- import _$1, { set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isObjectLike, has as has$1, isEqual as isEqual$4 } from "lodash";
14
- import { validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList, getUnitsForQuantity, convertAndGetValue, roundToPrecision } from "@oliasoft-open-source/units";
15
- import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
13
+ import _$1, { set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isEqual as isEqual$4 } from "lodash";
14
+ import { isScientificStringNum, roundToPrecision, roundToFixed, validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, label as label$b, altUnitsList, convertAndGetValue, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
16
15
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
17
16
  function getDefaultExportFromCjs(x2) {
18
17
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -3803,7 +3802,7 @@ const Tooltip = ({
3803
3802
  ],
3804
3803
  enabled = true,
3805
3804
  warning: warning2 = false,
3806
- maxWidth = "none",
3805
+ maxWidth = "40em",
3807
3806
  triggerOffset = 12,
3808
3807
  fontSize = "inherit",
3809
3808
  padding: padding2 = "var(--padding-xxs) var(--padding-xs)",
@@ -3811,7 +3810,7 @@ const Tooltip = ({
3811
3810
  flex = "none",
3812
3811
  forceOpen = false
3813
3812
  }) => {
3814
- const visible = enabled && (isValidElement(text2) || typeof text2 === "string" && text2.length > 0);
3813
+ const visible = enabled && (isValidElement(text2) || typeof text2 === "string" && text2.length > 0 || typeof text2 === "number");
3815
3814
  const [isOver, hoverProps, forceClose] = useHover({
3816
3815
  delayEnter: 100,
3817
3816
  delayLeave: 0
@@ -4133,8 +4132,10 @@ const Button$1 = ({
4133
4132
  warning: warning2,
4134
4133
  testId,
4135
4134
  tooltip: tooltip2,
4136
- inverted: inverted2 = false
4135
+ inverted: inverted2 = false,
4137
4136
  // *Deprecated*
4137
+ component: Component2 = "button",
4138
+ url
4138
4139
  }) => {
4139
4140
  const disabledContext = useContext(DisabledContext);
4140
4141
  const color2 = (() => {
@@ -4168,7 +4169,7 @@ const Button$1 = ({
4168
4169
  return "";
4169
4170
  })();
4170
4171
  return /* @__PURE__ */ jsx(ButtonTooltipWrapper, { tooltip: tooltip2, children: /* @__PURE__ */ jsxs(
4171
- "button",
4172
+ Component2,
4172
4173
  {
4173
4174
  type: type === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
4174
4175
  className: cx$2(
@@ -4192,6 +4193,7 @@ const Button$1 = ({
4192
4193
  ...title2 ? { title: title2 } : {},
4193
4194
  style: { width: width2 },
4194
4195
  "data-testid": testId,
4196
+ to: url,
4195
4197
  children: [
4196
4198
  icon2 && /* @__PURE__ */ jsx("span", { className: buttonStyles.icon, children: /* @__PURE__ */ jsx(Icon, { icon: icon2 }) }),
4197
4199
  loading && /* @__PURE__ */ jsx("span", { className: buttonStyles.icon, children: /* @__PURE__ */ jsx(
@@ -4208,42 +4210,44 @@ const Button$1 = ({
4208
4210
  }
4209
4211
  ) });
4210
4212
  };
4211
- const actions$2 = "_actions_1nid8_1";
4212
- const actionComponentContainer = "_actionComponentContainer_1nid8_11";
4213
- const active$7 = "_active_1nid8_33";
4213
+ const actions$2 = "_actions_1t7vd_1";
4214
+ const childComponent = "_childComponent_1t7vd_11";
4215
+ const actionComponentContainer = "_actionComponentContainer_1t7vd_14";
4216
+ const active$7 = "_active_1t7vd_36";
4214
4217
  const styles$M = {
4215
4218
  actions: actions$2,
4219
+ childComponent,
4216
4220
  actionComponentContainer,
4217
4221
  active: active$7
4218
4222
  };
4219
- const wrapper$4 = "_wrapper_uioq1_1";
4220
- const layer$1 = "_layer_uioq1_5";
4221
- const layerContainer$1 = "_layerContainer_uioq1_8";
4222
- const nested = "_nested_uioq1_23";
4223
- const fileInput$1 = "_fileInput_uioq1_35";
4224
- const trigger$2 = "_trigger_uioq1_40";
4225
- const middleAlignedInline = "_middleAlignedInline_uioq1_49";
4226
- const heading$5 = "_heading_uioq1_55";
4227
- const headingIcon = "_headingIcon_uioq1_61";
4228
- const option$1 = "_option_uioq1_73";
4229
- const active$6 = "_active_uioq1_92";
4230
- const selected$1 = "_selected_uioq1_97";
4231
- const optionContent$1 = "_optionContent_uioq1_103";
4232
- const inline$4 = "_inline_uioq1_107";
4233
- const icon$4 = "_icon_uioq1_112";
4234
- const check$1 = "_check_uioq1_113";
4235
- const text$3 = "_text_uioq1_135";
4236
- const label$a = "_label_uioq1_140";
4237
- const description = "_description_uioq1_151";
4238
- const arrow$1 = "_arrow_uioq1_155";
4239
- const divider$1 = "_divider_uioq1_159";
4240
- const deprecatedSemanticIcon = "_deprecatedSemanticIcon_uioq1_163";
4241
- const disabled$8 = "_disabled_uioq1_167";
4242
- const buttonLabel = "_buttonLabel_uioq1_172";
4243
- const buttonCaret = "_buttonCaret_uioq1_178";
4244
- const component = "_component_uioq1_182";
4245
- const right$7 = "_right_uioq1_188";
4246
- const actions$1 = "_actions_uioq1_193";
4223
+ const wrapper$4 = "_wrapper_1iw97_1";
4224
+ const layer$1 = "_layer_1iw97_5";
4225
+ const layerContainer$1 = "_layerContainer_1iw97_8";
4226
+ const nested = "_nested_1iw97_24";
4227
+ const fileInput$1 = "_fileInput_1iw97_36";
4228
+ const trigger$2 = "_trigger_1iw97_41";
4229
+ const middleAlignedInline = "_middleAlignedInline_1iw97_50";
4230
+ const heading$5 = "_heading_1iw97_56";
4231
+ const headingIcon = "_headingIcon_1iw97_62";
4232
+ const option$1 = "_option_1iw97_74";
4233
+ const active$6 = "_active_1iw97_93";
4234
+ const selected$1 = "_selected_1iw97_98";
4235
+ const optionContent$1 = "_optionContent_1iw97_104";
4236
+ const inline$4 = "_inline_1iw97_108";
4237
+ const icon$4 = "_icon_1iw97_113";
4238
+ const check$1 = "_check_1iw97_114";
4239
+ const text$3 = "_text_1iw97_136";
4240
+ const label$a = "_label_1iw97_141";
4241
+ const description = "_description_1iw97_152";
4242
+ const arrow$1 = "_arrow_1iw97_156";
4243
+ const divider$1 = "_divider_1iw97_160";
4244
+ const deprecatedSemanticIcon = "_deprecatedSemanticIcon_1iw97_164";
4245
+ const disabled$8 = "_disabled_1iw97_168";
4246
+ const buttonLabel = "_buttonLabel_1iw97_173";
4247
+ const buttonCaret = "_buttonCaret_1iw97_179";
4248
+ const component = "_component_1iw97_183";
4249
+ const right$7 = "_right_1iw97_189";
4250
+ const actions$1 = "_actions_1iw97_194";
4247
4251
  const styles$L = {
4248
4252
  wrapper: wrapper$4,
4249
4253
  layer: layer$1,
@@ -4302,7 +4306,8 @@ const Option$2 = ({
4302
4306
  title: title2,
4303
4307
  upload,
4304
4308
  onChange,
4305
- testId
4309
+ testId,
4310
+ component: Component2 = "a"
4306
4311
  }) => {
4307
4312
  const handleClick2 = (evt) => {
4308
4313
  evt.stopPropagation();
@@ -4318,9 +4323,10 @@ const Option$2 = ({
4318
4323
  onClick == null ? void 0 : onClick(evt);
4319
4324
  };
4320
4325
  return /* @__PURE__ */ jsxs(
4321
- "a",
4326
+ Component2,
4322
4327
  {
4323
4328
  href: url,
4329
+ to: url,
4324
4330
  className: cx$2(
4325
4331
  styles$L.option,
4326
4332
  disabled2 ? styles$L.disabled : "",
@@ -4406,7 +4412,8 @@ const Section$1 = ({
4406
4412
  title: section2.title,
4407
4413
  upload: section2.upload,
4408
4414
  onChange: section2.onChange,
4409
- testId: section2.testId
4415
+ testId: section2.testId,
4416
+ component: section2.component
4410
4417
  }
4411
4418
  );
4412
4419
  case MenuType.MENU:
@@ -4827,7 +4834,7 @@ const ContextMenu = ({
4827
4834
  path,
4828
4835
  groupOrder,
4829
4836
  overflowContainer: true,
4830
- maxHeight: "40vh",
4837
+ maxHeight: void 0,
4831
4838
  testId
4832
4839
  });
4833
4840
  const isDisabled = disabled2 || isMenuEmpty(menu2) || disabledContext;
@@ -5023,7 +5030,15 @@ const Actions = (props) => {
5023
5030
  const hidden2 = (action2 == null ? void 0 : action2.hidden) || !action2 || !Object.keys(action2).length;
5024
5031
  if (!hidden2) {
5025
5032
  if (action2.childComponent && React__default.isValidElement(action2.childComponent)) {
5026
- return /* @__PURE__ */ jsx("div", { "data-testid": action2.testId, children: action2.childComponent }, index2);
5033
+ return /* @__PURE__ */ jsx(
5034
+ "div",
5035
+ {
5036
+ "data-testid": action2.testId,
5037
+ className: styles$M.childComponent,
5038
+ children: action2.childComponent
5039
+ },
5040
+ index2
5041
+ );
5027
5042
  } else if (action2.subActions) {
5028
5043
  return /* @__PURE__ */ jsx(
5029
5044
  SubmenuActions,
@@ -9062,6 +9077,47 @@ const Empty = ({
9062
9077
  }
9063
9078
  );
9064
9079
  };
9080
+ const FileButton = ({
9081
+ file,
9082
+ accept,
9083
+ multi,
9084
+ name: name2,
9085
+ disabled: disabled2,
9086
+ onChange = () => {
9087
+ },
9088
+ ...buttonProps
9089
+ }) => {
9090
+ const disabledContext = useContext(DisabledContext);
9091
+ const inputRef = useRef(null);
9092
+ const handleClick2 = () => {
9093
+ var _a;
9094
+ if (!(disabled2 || disabledContext))
9095
+ (_a = inputRef.current) == null ? void 0 : _a.click();
9096
+ };
9097
+ const handleChange = (evt) => {
9098
+ var _a;
9099
+ const files = multi ? evt.target.files : (_a = evt.target.files) == null ? void 0 : _a[0];
9100
+ onChange({ ...evt, target: { ...evt.target, value: files } });
9101
+ if (inputRef.current) {
9102
+ inputRef.current.value = "";
9103
+ }
9104
+ };
9105
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
9106
+ /* @__PURE__ */ jsx(Button$1, { ...buttonProps, onClick: handleClick2 }),
9107
+ /* @__PURE__ */ jsx(
9108
+ "input",
9109
+ {
9110
+ name: name2,
9111
+ ref: inputRef,
9112
+ style: { display: "none" },
9113
+ type: "file",
9114
+ accept,
9115
+ multiple: multi,
9116
+ onChange: handleChange
9117
+ }
9118
+ )
9119
+ ] });
9120
+ };
9065
9121
  const inputGroup = "_inputGroup_biuoa_1";
9066
9122
  const styles$A = {
9067
9123
  inputGroup
@@ -9281,6 +9337,14 @@ const FileInput = ({
9281
9337
  if (!(disabled2 || disabledContext))
9282
9338
  (_a = inputRef.current) == null ? void 0 : _a.click();
9283
9339
  };
9340
+ const handleChange = (evt) => {
9341
+ var _a, _b, _c;
9342
+ const files = multi ? (_a = evt == null ? void 0 : evt.target) == null ? void 0 : _a.files : (_c = (_b = evt == null ? void 0 : evt.target) == null ? void 0 : _b.files) == null ? void 0 : _c[0];
9343
+ onChange({ ...evt, target: { ...evt.target, value: files } });
9344
+ if (inputRef.current) {
9345
+ inputRef.current.value = "";
9346
+ }
9347
+ };
9284
9348
  return /* @__PURE__ */ jsxs("div", { onClick: handleClick2, style: { width: width2 }, children: [
9285
9349
  /* @__PURE__ */ jsxs(InputGroup, { children: [
9286
9350
  /* @__PURE__ */ jsx(Input$1, { value: fileName || "", placeholder: placeholder3, disabled: true }),
@@ -9303,16 +9367,7 @@ const FileInput = ({
9303
9367
  type: "file",
9304
9368
  accept,
9305
9369
  multiple: multi,
9306
- onChange: (evt) => {
9307
- var _a, _b, _c;
9308
- onChange({
9309
- ...evt,
9310
- target: {
9311
- ...evt.target,
9312
- value: multi ? (_a = evt == null ? void 0 : evt.target) == null ? void 0 : _a.files : (_c = (_b = evt == null ? void 0 : evt.target) == null ? void 0 : _b.files) == null ? void 0 : _c[0]
9313
- }
9314
- });
9315
- },
9370
+ onChange: handleChange,
9316
9371
  "data-testid": testId
9317
9372
  }
9318
9373
  )
@@ -15423,7 +15478,7 @@ var getStyles = function getStyles2(rules2, property) {
15423
15478
  return rule.selector + " { " + value + " }";
15424
15479
  }).join(" ");
15425
15480
  };
15426
- var noPointerEvents = "pointer-events: none;";
15481
+ var noPointerEvents$1 = "pointer-events: none;";
15427
15482
  var getStyles$1 = function(contextId) {
15428
15483
  var getSelector2 = makeGetSelector(contextId);
15429
15484
  var dragHandle$1 = function() {
@@ -15433,7 +15488,7 @@ var getStyles$1 = function(contextId) {
15433
15488
  styles: {
15434
15489
  always: "\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",
15435
15490
  resting: grabCursor,
15436
- dragging: noPointerEvents,
15491
+ dragging: noPointerEvents$1,
15437
15492
  dropAnimating: grabCursor
15438
15493
  }
15439
15494
  };
@@ -18784,44 +18839,45 @@ var InfiniteScroll = (
18784
18839
  return InfiniteScroll2;
18785
18840
  }(Component$1)
18786
18841
  );
18787
- const inputInTable$8 = "_inputInTable_j55lv_1";
18788
- const inputHover$8 = "_inputHover_j55lv_13";
18789
- const inputFocus$8 = "_inputFocus_j55lv_18";
18790
- const inputError$8 = "_inputError_j55lv_25";
18791
- const inputWarning$8 = "_inputWarning_j55lv_26";
18792
- const inputDisabled$8 = "_inputDisabled_j55lv_61";
18793
- const hideScrollbars$8 = "_hideScrollbars_j55lv_67";
18794
- const header$1 = "_header_j55lv_77";
18795
- const headerTitle = "_headerTitle_j55lv_77";
18796
- const heading$3 = "_heading_j55lv_78";
18797
- const itemHeader = "_itemHeader_j55lv_78";
18798
- const narrow = "_narrow_j55lv_81";
18799
- const stickyHeader = "_stickyHeader_j55lv_85";
18800
- const title$3 = "_title_j55lv_96";
18801
- const name = "_name_j55lv_102";
18802
- const iconTooltipMargin = "_iconTooltipMargin_j55lv_105";
18803
- const bold = "_bold_j55lv_108";
18804
- const toggleNarrow = "_toggleNarrow_j55lv_117";
18805
- const drag$1 = "_drag_j55lv_135";
18806
- const list$1 = "_list_j55lv_155";
18807
- const bordered$1 = "_bordered_j55lv_159";
18808
- const item$4 = "_item_j55lv_78";
18809
- const action = "_action_j55lv_192";
18810
- const active$3 = "_active_j55lv_195";
18811
- const indented = "_indented_j55lv_202";
18812
- const disabled$5 = "_disabled_j55lv_215";
18813
- const label$6 = "_label_j55lv_226";
18814
- const details$2 = "_details_j55lv_237";
18815
- const metadata = "_metadata_j55lv_238";
18816
- const itemContent = "_itemContent_j55lv_246";
18817
- const indentIcon = "_indentIcon_j55lv_253";
18818
- const expandIcon = "_expandIcon_j55lv_258";
18819
- const expanded = "_expanded_j55lv_265";
18820
- const right$4 = "_right_j55lv_268";
18821
- const actions = "_actions_j55lv_276";
18822
- const scrollableList = "_scrollableList_j55lv_281";
18823
- const infiniteScrollContainer = "_infiniteScrollContainer_j55lv_286";
18824
- const hideScrollbar = "_hideScrollbar_j55lv_67";
18842
+ const inputInTable$8 = "_inputInTable_tn20e_1";
18843
+ const inputHover$8 = "_inputHover_tn20e_13";
18844
+ const inputFocus$8 = "_inputFocus_tn20e_18";
18845
+ const inputError$8 = "_inputError_tn20e_25";
18846
+ const inputWarning$8 = "_inputWarning_tn20e_26";
18847
+ const inputDisabled$8 = "_inputDisabled_tn20e_61";
18848
+ const hideScrollbars$8 = "_hideScrollbars_tn20e_67";
18849
+ const header$1 = "_header_tn20e_77";
18850
+ const headerTitle = "_headerTitle_tn20e_77";
18851
+ const heading$3 = "_heading_tn20e_78";
18852
+ const itemHeader = "_itemHeader_tn20e_78";
18853
+ const narrow = "_narrow_tn20e_81";
18854
+ const stickyHeader = "_stickyHeader_tn20e_85";
18855
+ const title$3 = "_title_tn20e_96";
18856
+ const name = "_name_tn20e_102";
18857
+ const iconTooltipMargin = "_iconTooltipMargin_tn20e_105";
18858
+ const bold = "_bold_tn20e_108";
18859
+ const toggleNarrow = "_toggleNarrow_tn20e_117";
18860
+ const drag$1 = "_drag_tn20e_135";
18861
+ const list$1 = "_list_tn20e_155";
18862
+ const bordered$1 = "_bordered_tn20e_159";
18863
+ const item$4 = "_item_tn20e_78";
18864
+ const action = "_action_tn20e_192";
18865
+ const active$3 = "_active_tn20e_195";
18866
+ const indented = "_indented_tn20e_202";
18867
+ const disabled$5 = "_disabled_tn20e_215";
18868
+ const label$6 = "_label_tn20e_226";
18869
+ const details$2 = "_details_tn20e_237";
18870
+ const metadata = "_metadata_tn20e_238";
18871
+ const itemContent = "_itemContent_tn20e_246";
18872
+ const indentIcon = "_indentIcon_tn20e_253";
18873
+ const expandIcon = "_expandIcon_tn20e_258";
18874
+ const expanded = "_expanded_tn20e_265";
18875
+ const right$4 = "_right_tn20e_268";
18876
+ const actions = "_actions_tn20e_276";
18877
+ const scrollableList = "_scrollableList_tn20e_281";
18878
+ const infiniteScrollContainer = "_infiniteScrollContainer_tn20e_286";
18879
+ const hideScrollbar = "_hideScrollbar_tn20e_67";
18880
+ const noPointerEvents = "_noPointerEvents_tn20e_303";
18825
18881
  const listStyles = {
18826
18882
  inputInTable: inputInTable$8,
18827
18883
  inputHover: inputHover$8,
@@ -18860,7 +18916,8 @@ const listStyles = {
18860
18916
  actions,
18861
18917
  scrollableList,
18862
18918
  infiniteScrollContainer,
18863
- hideScrollbar
18919
+ hideScrollbar,
18920
+ noPointerEvents
18864
18921
  };
18865
18922
  const ToggleNarrow = ({
18866
18923
  toggleNarrow: toggleNarrow2,
@@ -18990,10 +19047,12 @@ const ListRow = forwardRef(
18990
19047
  ({ items, expanding, invokeEditOnRowClick, provided, draggable: draggable2 }, listRowRefs) => {
18991
19048
  const disabledContext = useContext(DisabledContext);
18992
19049
  const listElement = (index2, provided2, item2, indent, hasOnClick, edit2) => {
19050
+ const Component2 = item2.component || "a";
18993
19051
  return /* @__PURE__ */ createElement(
18994
- "a",
19052
+ Component2,
18995
19053
  {
18996
19054
  href: item2.url,
19055
+ to: item2.url,
18997
19056
  ref: provided2 == null ? void 0 : provided2.innerRef,
18998
19057
  ...provided2.draggableProps,
18999
19058
  style: getItemStyle(provided2.draggableProps, item2),
@@ -19524,6 +19583,18 @@ const Modal = ({
19524
19583
  onEnter,
19525
19584
  onEscape
19526
19585
  }) => {
19586
+ const MODAL_CONTAINER_ID = "modalContainer";
19587
+ useEffect(() => {
19588
+ if (document.getElementById(MODAL_CONTAINER_ID)) {
19589
+ return;
19590
+ }
19591
+ const container2 = document.createElement("div");
19592
+ container2.id = MODAL_CONTAINER_ID;
19593
+ document.body.insertBefore(container2, document.body.firstChild);
19594
+ return () => {
19595
+ document.body.removeChild(container2);
19596
+ };
19597
+ }, []);
19527
19598
  useKeyboardEvent(
19528
19599
  "Enter",
19529
19600
  () => {
@@ -19542,10 +19613,7 @@ const Modal = ({
19542
19613
  },
19543
19614
  [visible, onEscape]
19544
19615
  );
19545
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
19546
- /* @__PURE__ */ jsx(Portal, { id: "modalContainer", children: visible ? /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Content$2, { width: width2, centered: centered2, children }) }) : null }),
19547
- /* @__PURE__ */ jsx("div", { id: "modalContainer" })
19548
- ] });
19616
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Portal, { id: MODAL_CONTAINER_ID, children: visible ? /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Content$2, { width: width2, centered: centered2, children }) }) : null }) });
19549
19617
  };
19550
19618
  const menu$1 = "_menu_12x4u_1";
19551
19619
  const header = "_header_12x4u_11";
@@ -21999,18 +22067,28 @@ const Popover = ({
21999
22067
  showCloseButton = false,
22000
22068
  testId,
22001
22069
  disabled: disabled2 = false,
22002
- overflowContainer = false
22070
+ overflowContainer = false,
22071
+ isOpen: externalIsOpen,
22072
+ onToggle: externalOnToggle
22003
22073
  }) => {
22004
22074
  const disabledContext = useContext(DisabledContext);
22005
- const [isOpen2, setOpen] = useState(false);
22006
- const close2 = () => setOpen(false);
22075
+ const [isOpen2, setOpen] = externalIsOpen !== void 0 ? [externalIsOpen, externalOnToggle] : useState(false);
22076
+ const close2 = () => {
22077
+ if (!disabled2 && !disabledContext) {
22078
+ if (setOpen) {
22079
+ setOpen(false);
22080
+ }
22081
+ }
22082
+ };
22007
22083
  const toggle2 = () => {
22008
22084
  if (!(disabled2 || disabledContext)) {
22009
- setOpen(!isOpen2);
22085
+ if (setOpen) {
22086
+ setOpen(!isOpen2);
22087
+ }
22010
22088
  }
22011
22089
  };
22012
22090
  useEffect(() => {
22013
- if (!(disabled2 || disabledContext)) {
22091
+ if (disabled2 || disabledContext) {
22014
22092
  close2();
22015
22093
  }
22016
22094
  }, [disabled2, disabledContext]);
@@ -55262,23 +55340,6 @@ if (process.env.NODE_ENV !== "production") {
55262
55340
  }
55263
55341
  var _default = Handle;
55264
55342
  default_1 = Handle$1.default = _default;
55265
- const SliderTooltip = ({ text: text2 }) => {
55266
- return /* @__PURE__ */ jsx(
55267
- TooltipLayer,
55268
- {
55269
- text: text2,
55270
- layerProps: {
55271
- style: {
55272
- whiteSpace: "nowrap",
55273
- position: "fixed",
55274
- transform: "translate(-50%, -100%)",
55275
- marginTop: -15,
55276
- marginLeft: 5
55277
- }
55278
- }
55279
- }
55280
- );
55281
- };
55282
55343
  const container = "_container_1a936_1";
55283
55344
  const small$2 = "_small_1a936_7";
55284
55345
  const hasMarks = "_hasMarks_1a936_10";
@@ -55360,6 +55421,14 @@ const Slider = ({
55360
55421
  icon: IconType.FAST_FORWARD
55361
55422
  }
55362
55423
  ) });
55424
+ const handleRender = (node2, handleProps) => {
55425
+ const isTooltipVisible = showTooltip && handleProps.dragging;
55426
+ return (
55427
+ // TODO: revisit - fix handle warning
55428
+ // @ts-ignore: revisit - fix handle warning
55429
+ /* @__PURE__ */ jsx(default_1, { ...node2.props, ...handleProps, children: isTooltipVisible && /* @__PURE__ */ jsx(Tooltip, { display: "block", text: tooltipFormatter(value), forceOpen: true, children: /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0 } }) }) })
55430
+ );
55431
+ };
55363
55432
  return /* @__PURE__ */ jsxs(
55364
55433
  "div",
55365
55434
  {
@@ -55372,10 +55441,10 @@ const Slider = ({
55372
55441
  style: vertical2.enabled ? { width: vertical2.width, height: vertical2.height } : { width: width2 },
55373
55442
  children: [
55374
55443
  showArrows && (vertical2.enabled ? /* @__PURE__ */ jsx(ButtonMax, {}) : /* @__PURE__ */ jsx(ButtonMin, {})),
55375
- range2 ? /* @__PURE__ */ jsx(
55444
+ /* @__PURE__ */ jsx(
55376
55445
  Slider$1,
55377
55446
  {
55378
- range: true,
55447
+ range: range2,
55379
55448
  allowCross: false,
55380
55449
  className: cx$2(
55381
55450
  (disabled2 || disabledContext) && styles$c.rcSliderDisabled,
@@ -55389,24 +55458,7 @@ const Slider = ({
55389
55458
  onChange: (v2) => onChangeValue(v2),
55390
55459
  disabled: disabled2 || disabledContext,
55391
55460
  vertical: vertical2.enabled,
55392
- handle: showTooltip ? ({ index: index2, value: value2, dragging, ...handleProps }) => /* @__PURE__ */ jsx(default_1, { value: value2, ...handleProps, children: dragging && /* @__PURE__ */ jsx(SliderTooltip, { text: tooltipFormatter(value2) }) }, index2) : void 0
55393
- }
55394
- ) : /* @__PURE__ */ jsx(
55395
- Slider$1,
55396
- {
55397
- className: cx$2(
55398
- (disabled2 || disabledContext) && styles$c.rcSliderDisabled,
55399
- showArrows && styles$c.hasArrows
55400
- ),
55401
- value,
55402
- max,
55403
- min,
55404
- step,
55405
- marks: formattedMarks,
55406
- onChange: (v2) => onChangeValue(v2),
55407
- disabled: disabled2 || disabledContext,
55408
- vertical: vertical2.enabled,
55409
- handle: showTooltip ? ({ index: index2, value: value2, dragging, ...handleProps }) => /* @__PURE__ */ jsx(default_1, { value: value2, ...handleProps, children: dragging && /* @__PURE__ */ jsx(SliderTooltip, { text: tooltipFormatter(value2) }) }, index2) : void 0
55461
+ handleRender
55410
55462
  }
55411
55463
  ),
55412
55464
  showArrows && (vertical2.enabled ? /* @__PURE__ */ jsx(ButtonMin, {}) : /* @__PURE__ */ jsx(ButtonMax, {})),
@@ -55569,19 +55621,23 @@ const TableScrollWrapper = ({
55569
55621
  }
55570
55622
  ) : children({ visibleRows }) });
55571
55623
  };
55572
- const clickableRow = "_clickableRow_11d5t_1";
55573
- const hoverableRow = "_hoverableRow_11d5t_4";
55574
- const rowActive = "_rowActive_11d5t_4";
55575
- const expandableRow = "_expandableRow_11d5t_8";
55576
- const flush2 = "_flush_11d5t_8";
55577
- const dragIconCell = "_dragIconCell_11d5t_28";
55578
- const dragIcon = "_dragIcon_11d5t_28";
55624
+ const clickableRow = "_clickableRow_1ki29_1";
55625
+ const hoverableRow = "_hoverableRow_1ki29_4";
55626
+ const rowActive = "_rowActive_1ki29_4";
55627
+ const expandableRow = "_expandableRow_1ki29_8";
55628
+ const flush2 = "_flush_1ki29_8";
55629
+ const errorRow = "_errorRow_1ki29_12";
55630
+ const warningRow = "_warningRow_1ki29_15";
55631
+ const dragIconCell = "_dragIconCell_1ki29_34";
55632
+ const dragIcon = "_dragIcon_1ki29_34";
55579
55633
  const styles$8 = {
55580
55634
  clickableRow,
55581
55635
  hoverableRow,
55582
55636
  rowActive,
55583
55637
  expandableRow,
55584
55638
  flush: flush2,
55639
+ errorRow,
55640
+ warningRow,
55585
55641
  dragIconCell,
55586
55642
  dragIcon
55587
55643
  };
@@ -55648,7 +55704,7 @@ const inputDisabled$1 = "_inputDisabled_u3xdj_61";
55648
55704
  const hideScrollbars$1 = "_hideScrollbars_u3xdj_67";
55649
55705
  const cell = "_cell_u3xdj_77";
55650
55706
  const disabledLink = "_disabledLink_u3xdj_87";
55651
- const inputWrapper = "_inputWrapper_u3xdj_91";
55707
+ const inputWrapper$1 = "_inputWrapper_u3xdj_91";
55652
55708
  const breakWord = "_breakWord_u3xdj_106";
55653
55709
  const inputCell = "_inputCell_u3xdj_109";
55654
55710
  const sliderCell = "_sliderCell_u3xdj_112";
@@ -55678,7 +55734,7 @@ const styles$7 = {
55678
55734
  hideScrollbars: hideScrollbars$1,
55679
55735
  cell,
55680
55736
  disabledLink,
55681
- inputWrapper,
55737
+ inputWrapper: inputWrapper$1,
55682
55738
  breakWord,
55683
55739
  inputCell,
55684
55740
  sliderCell,
@@ -55714,6 +55770,8 @@ const InputCell = ({
55714
55770
  var _a;
55715
55771
  return (_a = cell2.onChange) == null ? void 0 : _a.call(cell2, ev);
55716
55772
  },
55773
+ onFocus: cell2.onFocus,
55774
+ onBlur: cell2.onBlur,
55717
55775
  onPaste: (ev) => {
55718
55776
  var _a;
55719
55777
  return (_a = cell2.onPaste) == null ? void 0 : _a.call(cell2, ev);
@@ -55732,6 +55790,11 @@ const InputCell = ({
55732
55790
  }
55733
55791
  );
55734
55792
  };
55793
+ const COSMETIC_ROUNDING_DEFAULT_PRECISION = 14;
55794
+ const roundNumberCosmetic = (value) => {
55795
+ const isScientific = isScientificStringNum(value);
55796
+ return !isScientific ? roundToPrecision(value, COSMETIC_ROUNDING_DEFAULT_PRECISION) : value;
55797
+ };
55735
55798
  const getStringName$1 = (name2) => {
55736
55799
  if (!name2)
55737
55800
  return "";
@@ -55755,6 +55818,8 @@ const NumberInput = ({
55755
55818
  },
55756
55819
  onFocus = () => {
55757
55820
  },
55821
+ onBlur = () => {
55822
+ },
55758
55823
  tabIndex = 0,
55759
55824
  testId,
55760
55825
  tooltip: tooltip2 = null,
@@ -55763,80 +55828,118 @@ const NumberInput = ({
55763
55828
  },
55764
55829
  allowEmpty = false,
55765
55830
  isInTable: isInTable2,
55766
- groupOrder
55831
+ groupOrder,
55832
+ enableCosmeticRounding = true,
55833
+ enableDisplayRounding = false,
55834
+ roundDisplayValue,
55835
+ disableInternalErrorValidationMessages = false
55767
55836
  }) => {
55768
- const [displayValue, setDisplayValue] = useState(value);
55769
- const [validationError, setValidationError] = useState(null);
55837
+ const inputRef = useRef(null);
55838
+ const [displayValue, setDisplayValue] = useState(String(value));
55839
+ const [focus2, setFocus] = useState(false);
55840
+ const [pristine, setPristine] = useState(true);
55770
55841
  const stringName = getStringName$1(name2);
55771
55842
  const validateInputValue = (value2) => {
55772
- let validation = validateNumber(value2);
55843
+ const validation = validateNumber(value2);
55773
55844
  if (allowEmpty && value2 === "" || validation.valid) {
55774
55845
  return { ...validation, valid: true, errors: void 0 };
55775
55846
  } else {
55776
55847
  return validation;
55777
55848
  }
55778
55849
  };
55850
+ const { valid, errors: errors2 } = validateInputValue(displayValue);
55851
+ const firstError = errors2 && errors2.length && !disableInternalErrorValidationMessages ? errors2[0] : null;
55779
55852
  useEffect(() => {
55780
- const { valid, errors: errors2 } = validateInputValue(value);
55781
- setDisplayValue(value);
55782
- if (valid) {
55783
- setValidationError(null);
55784
- validationCallback(stringName, null);
55785
- } else {
55786
- const firstError = errors2 && errors2.length ? errors2[0] : null;
55787
- setValidationError(firstError);
55853
+ setDisplayValue(String(value));
55854
+ }, [value, enableCosmeticRounding, enableDisplayRounding]);
55855
+ useEffect(() => {
55856
+ if (!focus2 && !valid) {
55788
55857
  validationCallback(stringName, firstError);
55858
+ } else {
55859
+ validationCallback(stringName, null);
55789
55860
  }
55790
- }, [value, error2]);
55791
- const onSetValue = (evt) => {
55792
- const input2 = evt.target;
55793
- const { value: value2 } = input2;
55794
- const inputValue = cleanNumStr(
55795
- value2.replaceAll(" ", "").replaceAll("|", "")
55796
- );
55797
- const { valid, errors: errors2 } = validateInputValue(inputValue);
55798
- if (valid) {
55799
- const newEvent = {
55861
+ }, [focus2, valid, error2]);
55862
+ const onChangeValue = (evt) => {
55863
+ if (valid && !pristine) {
55864
+ const event = {
55800
55865
  ...evt,
55801
55866
  target: {
55802
55867
  ...evt.target,
55803
- value: inputValue,
55868
+ value: String(displayValue),
55804
55869
  name: stringName
55805
55870
  }
55806
55871
  };
55807
- onChange(newEvent);
55808
- setDisplayValue(inputValue);
55809
- setValidationError(null);
55810
- validationCallback(stringName, null);
55811
- } else {
55812
- setDisplayValue(inputValue);
55813
- const firstError = errors2 && errors2.length ? errors2[0] : null;
55814
- setValidationError(firstError);
55815
- validationCallback(stringName, firstError);
55872
+ onChange(event);
55816
55873
  }
55817
55874
  };
55875
+ const onSetValue = (evt) => {
55876
+ const input2 = evt.target;
55877
+ const { value: value2 } = input2;
55878
+ const inputValue = cleanNumStr(
55879
+ value2.replaceAll(" ", "").replaceAll("|", "")
55880
+ );
55881
+ setDisplayValue(inputValue);
55882
+ setPristine(false);
55883
+ };
55884
+ useEffect(() => {
55885
+ if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55886
+ const textInput = inputRef.current;
55887
+ if (textInput) {
55888
+ setTimeout(() => {
55889
+ const { length: length2 } = String(displayValue);
55890
+ textInput.setSelectionRange(length2, length2);
55891
+ }, 0);
55892
+ }
55893
+ }
55894
+ }, [focus2]);
55895
+ const onInputFocus = (evt) => {
55896
+ setFocus(true);
55897
+ onFocus(evt);
55898
+ };
55899
+ const onInputBlur = (evt) => {
55900
+ setFocus(false);
55901
+ onChangeValue(evt);
55902
+ onBlur(evt);
55903
+ };
55904
+ const shouldDisplayRound = enableDisplayRounding && !focus2 && valid;
55905
+ const valueWithDisplayRounding = shouldDisplayRound ? roundDisplayValue ? String(roundDisplayValue(displayValue)) : roundToFixed(displayValue, 2) : displayValue;
55906
+ const displayValueEndsWithZero = !!(valueWithDisplayRounding == null ? void 0 : valueWithDisplayRounding.endsWith("0"));
55907
+ const shouldCosmeticallyRound = enableCosmeticRounding && // only when prop is enabled
55908
+ valueWithDisplayRounding && // not when empty typed value
55909
+ !displayValueEndsWithZero && // not when intentionally trying to type trailing zeros as interim values (OW-17109)
55910
+ valid;
55911
+ const valueWithCosmeticRounding = shouldCosmeticallyRound ? roundNumberCosmetic(valueWithDisplayRounding) : valueWithDisplayRounding;
55818
55912
  return /* @__PURE__ */ jsx(
55819
- Input$1,
55913
+ KeyboardEventHandler,
55820
55914
  {
55821
- type: "text",
55822
- name: stringName,
55823
- testId,
55824
- disabled: disabled2,
55825
- placeholder: placeholder3,
55826
- value: displayValue,
55827
- onChange: onSetValue,
55828
- onFocus,
55829
- error: error2 || validationError,
55830
- warning: warning2,
55831
- right: !left2,
55832
- small: small2,
55833
- width: width2,
55834
- isInTable: isInTable2,
55835
- groupOrder,
55836
- tabIndex,
55837
- tooltip: tooltip2
55838
- },
55839
- stringName
55915
+ handleKeys: [EventKey.ENTER],
55916
+ onKeyEvent: (_key, evt) => onChangeValue(evt),
55917
+ children: /* @__PURE__ */ jsx(
55918
+ Input$1,
55919
+ {
55920
+ type: "text",
55921
+ name: stringName,
55922
+ testId,
55923
+ disabled: disabled2,
55924
+ placeholder: placeholder3,
55925
+ value: valueWithCosmeticRounding,
55926
+ onChange: onSetValue,
55927
+ onFocus: onInputFocus,
55928
+ onBlur: onInputBlur,
55929
+ error: !focus2 && (firstError || error2),
55930
+ warning: warning2,
55931
+ right: !left2,
55932
+ small: small2,
55933
+ width: width2,
55934
+ isInTable: isInTable2,
55935
+ groupOrder,
55936
+ tabIndex,
55937
+ tooltip: tooltip2,
55938
+ ref: inputRef
55939
+ },
55940
+ stringName
55941
+ )
55942
+ }
55840
55943
  );
55841
55944
  };
55842
55945
  const NumberInputCell = ({ cell: cell2, testId }) => {
@@ -55849,6 +55952,8 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
55849
55952
  var _a;
55850
55953
  return (_a = cell2.onChange) == null ? void 0 : _a.call(cell2, ev);
55851
55954
  },
55955
+ onFocus: cell2.onFocus,
55956
+ onBlur: cell2.onBlur,
55852
55957
  placeholder: cell2.placeholder,
55853
55958
  error: cell2.error,
55854
55959
  warning: cell2.warning,
@@ -55859,7 +55964,10 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
55859
55964
  testId,
55860
55965
  tooltip: cell2.tooltip,
55861
55966
  validationCallback: cell2.validationCallback,
55862
- allowEmpty: cell2.allowEmpty
55967
+ allowEmpty: cell2.allowEmpty,
55968
+ enableCosmeticRounding: cell2.enableCosmeticRounding,
55969
+ enableDisplayRounding: cell2.enableDisplayRounding,
55970
+ roundDisplayValue: cell2.roundDisplayValue
55863
55971
  }
55864
55972
  );
55865
55973
  };
@@ -55892,6 +56000,7 @@ const SelectCell = ({
55892
56000
  maxTooltipWidth: cell2.maxTooltipWidth,
55893
56001
  width: "100%",
55894
56002
  autoLayerWidth: cell2.autoLayerWidth,
56003
+ multi: cell2.multi,
55895
56004
  right: columnAlignment === Align.RIGHT,
55896
56005
  testId,
55897
56006
  tabIndex: cell2.disabled ? -1 : 0
@@ -56126,6 +56235,7 @@ var CellType = /* @__PURE__ */ ((CellType2) => {
56126
56235
  CellType2["SLIDER"] = "Slider";
56127
56236
  CellType2["CHECKBOX"] = "CheckBox";
56128
56237
  CellType2["ACTIONS"] = "Actions";
56238
+ CellType2["AUTO_UNIT"] = "AutoUnit";
56129
56239
  return CellType2;
56130
56240
  })(CellType || {});
56131
56241
  const Cell = ({
@@ -56208,6 +56318,8 @@ const Row = ({
56208
56318
  onRowMouseEnter,
56209
56319
  onRowMouseLeave,
56210
56320
  expandedContent,
56321
+ error: error2,
56322
+ warning: warning2,
56211
56323
  active: active2
56212
56324
  } = row2;
56213
56325
  const cells = row2.cells.map((c2, i) => {
@@ -56299,7 +56411,9 @@ const Row = ({
56299
56411
  className: cx$2(
56300
56412
  onRowClick && !onRowClick.noStyle ? styles$8.clickableRow : null,
56301
56413
  onRowMouseEnter && !onRowMouseEnter.noStyle ? styles$8.hoverableRow : null,
56302
- active2 ? styles$8.rowActive : null
56414
+ active2 ? styles$8.rowActive : null,
56415
+ error2 ? styles$8.errorRow : null,
56416
+ warning2 ? styles$8.warningRow : null
56303
56417
  ),
56304
56418
  ref: (provided == null ? void 0 : provided.innerRef) || null,
56305
56419
  ...(provided == null ? void 0 : provided.draggableProps) || null,
@@ -56728,9 +56842,20 @@ const TextLink = ({
56728
56842
  href = void 0,
56729
56843
  target = void 0,
56730
56844
  testId,
56731
- onClick
56845
+ onClick,
56846
+ component: Component2 = "a"
56732
56847
  }) => {
56733
- return /* @__PURE__ */ jsx("a", { href, target, onClick, "data-testid": testId, children: /* @__PURE__ */ jsx(Text, { link: true, children }) });
56848
+ return /* @__PURE__ */ jsx(
56849
+ Component2,
56850
+ {
56851
+ href,
56852
+ to: href,
56853
+ target,
56854
+ onClick,
56855
+ "data-testid": testId,
56856
+ children: /* @__PURE__ */ jsx(Text, { link: true, children })
56857
+ }
56858
+ );
56734
56859
  };
56735
56860
  const inputInTable = "_inputInTable_66zck_1";
56736
56861
  const inputHover = "_inputHover_66zck_13";
@@ -57996,22 +58121,22 @@ const Toggle = ({
57996
58121
  }
57997
58122
  );
57998
58123
  };
57999
- const topbar = "_topbar_gmfjn_11";
58000
- const fixed = "_fixed_gmfjn_21";
58001
- const appSwitcher = "_appSwitcher_gmfjn_29";
58002
- const title = "_title_gmfjn_75";
58003
- const logo = "_logo_gmfjn_91";
58004
- const label = "_label_gmfjn_94";
58005
- const brand = "_brand_gmfjn_99";
58006
- const version = "_version_gmfjn_104";
58007
- const left = "_left_gmfjn_111";
58008
- const right = "_right_gmfjn_112";
58009
- const item = "_item_gmfjn_126";
58010
- const link = "_link_gmfjn_127";
58011
- const button = "_button_gmfjn_139";
58012
- const menu = "_menu_gmfjn_140";
58013
- const active = "_active_gmfjn_168";
58014
- const alert = "_alert_gmfjn_193";
58124
+ const topbar = "_topbar_oyr59_11";
58125
+ const fixed = "_fixed_oyr59_21";
58126
+ const appSwitcher = "_appSwitcher_oyr59_29";
58127
+ const title = "_title_oyr59_75";
58128
+ const logo = "_logo_oyr59_91";
58129
+ const label = "_label_oyr59_94";
58130
+ const brand = "_brand_oyr59_99";
58131
+ const version = "_version_oyr59_104";
58132
+ const left = "_left_oyr59_111";
58133
+ const right = "_right_oyr59_112";
58134
+ const item = "_item_oyr59_126";
58135
+ const link = "_link_oyr59_127";
58136
+ const button = "_button_oyr59_138";
58137
+ const menu = "_menu_oyr59_139";
58138
+ const active = "_active_oyr59_168";
58139
+ const alert = "_alert_oyr59_193";
58015
58140
  const styles$3 = {
58016
58141
  topbar,
58017
58142
  fixed,
@@ -58069,7 +58194,8 @@ const Link = ({
58069
58194
  onClick,
58070
58195
  active: active2,
58071
58196
  disabled: disabled2,
58072
- testId
58197
+ testId,
58198
+ component: Component2 = "a"
58073
58199
  }) => {
58074
58200
  const disabledContext = useContext(DisabledContext);
58075
58201
  const handleClick2 = (event) => {
@@ -58079,10 +58205,11 @@ const Link = ({
58079
58205
  onClick == null ? void 0 : onClick(event);
58080
58206
  };
58081
58207
  return /* @__PURE__ */ jsxs(
58082
- "a",
58208
+ Component2,
58083
58209
  {
58084
58210
  className: cx$2(styles$3.link, active2 ? styles$3.active : ""),
58085
58211
  href: url || "#",
58212
+ to: url,
58086
58213
  onClick: handleClick2,
58087
58214
  "aria-disabled": disabled2 || disabledContext,
58088
58215
  "data-testid": testId,
@@ -58106,7 +58233,8 @@ const Element$1 = ({ element }) => {
58106
58233
  onClick: element.onClick,
58107
58234
  active: element.active,
58108
58235
  disabled: element.disabled,
58109
- testId: element.testId
58236
+ testId: element.testId,
58237
+ component: element.component
58110
58238
  }
58111
58239
  ) });
58112
58240
  case ElementType.BUTTON:
@@ -69925,12 +70053,12 @@ function TreeInner(props, ref2) {
69925
70053
  );
69926
70054
  }
69927
70055
  var Tree$1 = forwardRef(TreeInner);
69928
- const tree = "_tree_1lv9u_1";
69929
- const toggle = "_toggle_1lv9u_4";
69930
- const dropTarget = "_dropTarget_1lv9u_11";
69931
- const draggingSource = "_draggingSource_1lv9u_14";
69932
- const placeholderContainer = "_placeholderContainer_1lv9u_17";
69933
- const placeholder2 = "_placeholder_1lv9u_17";
70056
+ const tree = "_tree_15yn1_1";
70057
+ const toggle = "_toggle_15yn1_4";
70058
+ const dropTarget = "_dropTarget_15yn1_11";
70059
+ const draggingSource = "_draggingSource_15yn1_26";
70060
+ const placeholderContainer = "_placeholderContainer_15yn1_29";
70061
+ const placeholder2 = "_placeholder_15yn1_29";
69934
70062
  const styles$1 = {
69935
70063
  tree,
69936
70064
  toggle,
@@ -69946,14 +70074,46 @@ const TreeItem = ({
69946
70074
  onToggle,
69947
70075
  hasChild,
69948
70076
  draggable: draggable2,
69949
- icons: icons2
70077
+ icons: icons2,
70078
+ onDrop
69950
70079
  }) => {
69951
70080
  const { id: id2, data } = node2;
69952
70081
  const { active: active2, testId, onClick, actions: actions2 = [] } = data;
70082
+ const [isDragOver, setDragOver] = React__default.useState(false);
70083
+ const [dragOverStartTime, setDragOverStartTime] = React__default.useState(0);
69953
70084
  const handleToggle = (e2) => {
69954
70085
  e2.stopPropagation();
69955
70086
  onToggle(id2);
69956
70087
  };
70088
+ const handleDragEnter = (event) => {
70089
+ event.preventDefault();
70090
+ event.stopPropagation();
70091
+ if (!isDragOver) {
70092
+ setDragOver(true);
70093
+ setDragOverStartTime((/* @__PURE__ */ new Date()).getTime());
70094
+ }
70095
+ };
70096
+ const handleDragLeave = (event) => {
70097
+ event.preventDefault();
70098
+ event.stopPropagation();
70099
+ if ((/* @__PURE__ */ new Date()).getTime() - dragOverStartTime > 20) {
70100
+ setDragOver(false);
70101
+ }
70102
+ };
70103
+ const handleDragOver = (event) => {
70104
+ event.preventDefault();
70105
+ event.stopPropagation();
70106
+ if (hasChild && !isOpen2 && (/* @__PURE__ */ new Date()).getTime() - dragOverStartTime > 200) {
70107
+ handleToggle(event);
70108
+ }
70109
+ };
70110
+ const handleDrop = (event) => {
70111
+ event.preventDefault();
70112
+ event.stopPropagation();
70113
+ setDragOver(false);
70114
+ setDragOverStartTime((/* @__PURE__ */ new Date()).getTime());
70115
+ onDrop == null ? void 0 : onDrop(event);
70116
+ };
69957
70117
  return /* @__PURE__ */ jsx(
69958
70118
  "div",
69959
70119
  {
@@ -69961,7 +70121,8 @@ const TreeItem = ({
69961
70121
  listStyles.item,
69962
70122
  listStyles.action,
69963
70123
  active2 ? listStyles.active : "",
69964
- depth > 0 ? listStyles.indented : ""
70124
+ depth > 0 ? listStyles.indented : "",
70125
+ isDragOver ? listStyles.bordered : ""
69965
70126
  ),
69966
70127
  style: {
69967
70128
  marginInlineStart: depth * 24
@@ -69974,10 +70135,17 @@ const TreeItem = ({
69974
70135
  handleToggle(evt);
69975
70136
  }
69976
70137
  },
70138
+ onDrop: (evt) => onDrop ? handleDrop(evt) : {},
70139
+ onDragEnter: (evt) => onDrop ? handleDragEnter(evt) : {},
70140
+ onDragOver: (evt) => onDrop ? handleDragOver(evt) : {},
70141
+ onDragLeave: (evt) => onDrop ? handleDragLeave(evt) : {},
69977
70142
  children: /* @__PURE__ */ jsxs(
69978
70143
  "div",
69979
70144
  {
69980
- className: listStyles.itemHeader,
70145
+ className: cx$2(
70146
+ listStyles.itemHeader,
70147
+ isDragOver ? listStyles.noPointerEvents : ""
70148
+ ),
69981
70149
  children: [
69982
70150
  hasChild && /* @__PURE__ */ jsx("div", { className: styles$1.toggle, children: /* @__PURE__ */ jsx(
69983
70151
  Button$1,
@@ -70010,35 +70178,89 @@ const Tree = ({
70010
70178
  treeRef,
70011
70179
  itemHasChild,
70012
70180
  onItemToggle,
70013
- icons: icons2
70181
+ icons: icons2,
70182
+ allowParentReassignment
70014
70183
  }) => {
70015
70184
  var _a;
70016
- const handleDrop = (newTree) => {
70017
- if (onListReorder) {
70018
- const newList = newTree.map(({ id: id2, parent, droppable: droppable2, data }) => ({
70185
+ const handleOpen = (id2) => {
70186
+ if (onChangeOpen) {
70187
+ onChangeOpen(id2);
70188
+ }
70189
+ };
70190
+ const findNodeIndexById = (tree22, id2) => {
70191
+ return (tree22 == null ? void 0 : tree22.findIndex((node2) => (node2 == null ? void 0 : node2.id) === id2)) ?? -1;
70192
+ };
70193
+ const setDragSourceParentToGrandparent = (dragSource, workingTree) => {
70194
+ const dragSourceParentIndex = findNodeIndexById(
70195
+ workingTree,
70196
+ dragSource == null ? void 0 : dragSource.parent
70197
+ );
70198
+ if (dragSourceParentIndex >= 0) {
70199
+ const grandparent = workingTree == null ? void 0 : workingTree.find(
70200
+ (node2) => {
70201
+ var _a2;
70202
+ return (node2 == null ? void 0 : node2.id) === ((_a2 = workingTree[dragSourceParentIndex]) == null ? void 0 : _a2.parent);
70203
+ }
70204
+ );
70205
+ dragSource.parent = grandparent ? grandparent.id : 0;
70206
+ }
70207
+ };
70208
+ const removeDragSourceFromWorkingTree = (dragSource, workingTree) => {
70209
+ return (workingTree == null ? void 0 : workingTree.filter((node2) => (node2 == null ? void 0 : node2.id) !== (dragSource == null ? void 0 : dragSource.id))) ?? [];
70210
+ };
70211
+ const insertDragSourceAfterParentInWorkingTree = (dragSource, dragSourceParentIndex, workingTree) => {
70212
+ workingTree == null ? void 0 : workingTree.splice(dragSourceParentIndex, 0, dragSource);
70213
+ return workingTree;
70214
+ };
70215
+ const transformTreeToList = (tree22) => {
70216
+ return tree22.map(({ id: id2, parent, droppable: droppable2, data }) => {
70217
+ return {
70019
70218
  id: id2,
70020
70219
  parent,
70021
70220
  droppable: droppable2,
70022
70221
  ...data
70023
- }));
70024
- onListReorder(newList);
70025
- }
70222
+ };
70223
+ });
70026
70224
  };
70027
- const handleOpen = (id2) => {
70028
- if (onChangeOpen) {
70029
- onChangeOpen(id2);
70225
+ const handleDrop = (newTree, option2) => {
70226
+ const { dragSource, dropTarget: dropTarget2 } = option2;
70227
+ let workingTree = [...newTree];
70228
+ if (!onListReorder)
70229
+ return;
70230
+ const dragSourceIndex = findNodeIndexById(workingTree, dragSource == null ? void 0 : dragSource.id);
70231
+ const dragSourceParentIndex = findNodeIndexById(
70232
+ workingTree,
70233
+ dragSource == null ? void 0 : dragSource.parent
70234
+ );
70235
+ let newList = [];
70236
+ if ((dragSource == null ? void 0 : dragSource.parent) === (dropTarget2 == null ? void 0 : dropTarget2.id) && dragSourceIndex === 0 && allowParentReassignment) {
70237
+ setDragSourceParentToGrandparent(dragSource, workingTree);
70238
+ workingTree = removeDragSourceFromWorkingTree(
70239
+ dragSource,
70240
+ workingTree
70241
+ );
70242
+ workingTree = insertDragSourceAfterParentInWorkingTree(
70243
+ dragSource,
70244
+ dragSourceParentIndex,
70245
+ workingTree
70246
+ );
70030
70247
  }
70248
+ newList = transformTreeToList(workingTree);
70249
+ onListReorder(newList);
70031
70250
  };
70032
- const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(({ id: id2, droppable: droppable2, parent, name: name2, ...rest }) => ({
70033
- id: id2,
70034
- text: name2,
70035
- droppable: droppable2,
70036
- parent,
70037
- data: {
70038
- name: name2,
70039
- ...rest
70040
- }
70041
- }));
70251
+ const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(
70252
+ ({ id: id2, droppable: droppable2, parent, name: name2, onDrop, ...rest }) => ({
70253
+ id: id2,
70254
+ text: name2,
70255
+ droppable: droppable2,
70256
+ parent,
70257
+ data: {
70258
+ name: name2,
70259
+ onDrop,
70260
+ ...rest
70261
+ }
70262
+ })
70263
+ );
70042
70264
  return /* @__PURE__ */ jsxs("div", { "data-testid": testId, children: [
70043
70265
  list2.name && !list2.noHeader && /* @__PURE__ */ jsx(ListHeading, { name: list2.name, actions: list2.actions }),
70044
70266
  /* @__PURE__ */ jsx("div", { className: listStyles.list, children: /* @__PURE__ */ jsx(
@@ -70062,6 +70284,7 @@ const Tree = ({
70062
70284
  },
70063
70285
  rootId: 0,
70064
70286
  render: (node2, { depth, isOpen: isOpen2, onToggle, hasChild }) => {
70287
+ var _a2;
70065
70288
  return /* @__PURE__ */ jsx(
70066
70289
  TreeItem,
70067
70290
  {
@@ -70074,7 +70297,8 @@ const Tree = ({
70074
70297
  onToggle();
70075
70298
  },
70076
70299
  draggable: draggable2,
70077
- icons: icons2
70300
+ icons: icons2,
70301
+ onDrop: (_a2 = node2.data) == null ? void 0 : _a2.onDrop
70078
70302
  }
70079
70303
  );
70080
70304
  },
@@ -70175,45 +70399,6 @@ const getStringName = (name2) => {
70175
70399
  }
70176
70400
  return typeof name2 === "string" ? name2 : "";
70177
70401
  };
70178
- const isErrorObject = (error2) => isObjectLike(error2) && has$1(error2, "message");
70179
- const getErrorMessage = (error2) => {
70180
- if (typeof error2 === "string") {
70181
- return error2;
70182
- } else if (isErrorObject(error2)) {
70183
- return error2.message;
70184
- } else {
70185
- return null;
70186
- }
70187
- };
70188
- const hasLeadingZeroes = (value) => {
70189
- return value.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g)) === 0;
70190
- };
70191
- const validate = (value, options) => {
70192
- var _a;
70193
- const {
70194
- allowEmpty = false,
70195
- autoValue,
70196
- placeholder: placeholder3,
70197
- disabledValidation = false
70198
- } = options || {};
70199
- const stringValue = String(value);
70200
- if (disabledValidation || autoValue || placeholder3) {
70201
- return null;
70202
- }
70203
- const cleanValue = isValueWithUnit$1(stringValue) ? getValue$1(stringValue) : stringValue;
70204
- if (allowEmpty && cleanValue === "") {
70205
- return null;
70206
- }
70207
- if (hasLeadingZeroes(cleanValue)) {
70208
- return "Invalid number format due to leading zeroes";
70209
- }
70210
- const validationErrors = validateNumber(cleanValue);
70211
- if (!validationErrors.valid) {
70212
- const firstError = ((_a = validationErrors == null ? void 0 : validationErrors.errors) == null ? void 0 : _a[0]) ?? null;
70213
- return getErrorMessage(firstError);
70214
- }
70215
- return null;
70216
- };
70217
70402
  const isUnitKnown = (unit2 = "") => {
70218
70403
  var _a;
70219
70404
  return (_a = KNOWN_UNITS) == null ? void 0 : _a.includes(unit2);
@@ -70222,16 +70407,18 @@ const isKnownUnit = (valueWithUnit, defaultUnit) => {
70222
70407
  const unitFromValue = getUnit(valueWithUnit || "");
70223
70408
  return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
70224
70409
  };
70225
- const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
70410
+ const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
70411
+ const inputWrapper = "_inputWrapper_ye9w9_4";
70226
70412
  const styles = {
70227
- predefinedMenuActive
70413
+ predefinedMenuActive,
70414
+ inputWrapper
70228
70415
  };
70229
70416
  const UnitInput = ({
70230
70417
  name: name2,
70231
70418
  placeholder: placeholder3 = "",
70232
70419
  disabled: disabled2 = false,
70233
70420
  disabledUnit = false,
70234
- error: error2 = null,
70421
+ error: error2 = false,
70235
70422
  left: left2 = false,
70236
70423
  small: small2 = false,
70237
70424
  width: width2 = "100%",
@@ -70250,15 +70437,18 @@ const UnitInput = ({
70250
70437
  unitTemplate,
70251
70438
  doNotConvertValue = false,
70252
70439
  testId,
70253
- warning: warning2 = null,
70440
+ warning: warning2 = false,
70254
70441
  predefinedOptions,
70255
70442
  initialPredefinedOption = false,
70256
70443
  shouldLinkAutomaticly = true,
70257
70444
  selectedPredefinedOptionKey,
70258
- validationCallback = () => ({ name: "", error: null }),
70445
+ validationCallback,
70259
70446
  disabledValidation = false,
70260
70447
  allowEmpty = false,
70261
- autoValue
70448
+ autoValue,
70449
+ convertBackToStorageUnit = false,
70450
+ enableCosmeticRounding = true,
70451
+ enableDisplayRounding = false
70262
70452
  }) => {
70263
70453
  if (typeof value === "number") {
70264
70454
  value = `${value}`;
@@ -70287,11 +70477,11 @@ const UnitInput = ({
70287
70477
  );
70288
70478
  const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70289
70479
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70290
- const [validationError, setValidationError] = useState(null);
70291
70480
  const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
70292
70481
  initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70293
70482
  );
70294
70483
  const isAutoValue = propValue === "" && autoValue;
70484
+ const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || placeholder3);
70295
70485
  const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
70296
70486
  if (selectedPredefinedOptionKey) {
70297
70487
  return selectedPredefinedOptionKey === el2.valueKey;
@@ -70320,33 +70510,16 @@ const UnitInput = ({
70320
70510
  const stringName2 = getStringName(name2);
70321
70511
  const input2 = evt.target;
70322
70512
  const { value: inputValue, selectionStart: currentCursorPosition } = input2;
70323
- const cleanInputValue = cleanNumStr(
70324
- inputValue.replaceAll(" ", "").replaceAll("|", "")
70325
- );
70326
- const newValue = withUnit(cleanInputValue, (displayLayer == null ? void 0 : displayLayer.unit) || "");
70327
- const rawValue = getValue$1(newValue);
70328
- const validationResult = validate(rawValue, {
70329
- allowEmpty,
70330
- autoValue,
70331
- placeholder: placeholder3,
70332
- disabledValidation
70513
+ const newValue = withUnit(inputValue, (displayLayer == null ? void 0 : displayLayer.unit) || "");
70514
+ const returnValue = convertBackToStorageUnit ? withUnit(convertAndGetValue(newValue, propUnit), propUnit) : newValue;
70515
+ onChange({
70516
+ target: {
70517
+ value: returnValue,
70518
+ name: stringName2
70519
+ }
70333
70520
  });
70334
- if (validationResult === null) {
70335
- onChange({
70336
- target: {
70337
- value: newValue,
70338
- name: stringName2
70339
- }
70340
- });
70341
- const [val, u] = split$1(newValue);
70342
- setDisplayLayer({ value: val, unit: u });
70343
- setValidationError(null);
70344
- validationCallback(stringName2, null);
70345
- } else {
70346
- setDisplayLayer({ value: cleanInputValue, unit: displayLayer.unit });
70347
- setValidationError(validationResult);
70348
- validationCallback(stringName2, validationResult);
70349
- }
70521
+ const [val, u] = split$1(newValue);
70522
+ setDisplayLayer({ value: val, unit: u });
70350
70523
  runAfterUpdate(() => {
70351
70524
  input2.selectionStart = currentCursorPosition;
70352
70525
  input2.selectionEnd = currentCursorPosition;
@@ -70392,14 +70565,6 @@ const UnitInput = ({
70392
70565
  }
70393
70566
  }
70394
70567
  }
70395
- const cleanValue = checkAndCleanDecimalComma(propValue);
70396
- const errorMessage = validate(cleanValue, {
70397
- allowEmpty,
70398
- autoValue,
70399
- placeholder: placeholder3,
70400
- disabledValidation
70401
- });
70402
- setValidationError(errorMessage);
70403
70568
  }, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
70404
70569
  const alternativeUnits = getAlternativeUnits();
70405
70570
  const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
@@ -70433,6 +70598,14 @@ const UnitInput = ({
70433
70598
  selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
70434
70599
  };
70435
70600
  };
70601
+ const handleValidationCallback = (name22, error22) => {
70602
+ if (validationCallback) {
70603
+ validationCallback({
70604
+ name: name22,
70605
+ error: error22
70606
+ });
70607
+ }
70608
+ };
70436
70609
  sectionsPredefinedMenu = [
70437
70610
  {
70438
70611
  type: MenuType.OPTION,
@@ -70489,10 +70662,9 @@ const UnitInput = ({
70489
70662
  )
70490
70663
  }
70491
70664
  ),
70492
- /* @__PURE__ */ jsx(
70493
- Input$1,
70665
+ /* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
70666
+ NumberInput,
70494
70667
  {
70495
- type: "text",
70496
70668
  name: stringName,
70497
70669
  testId,
70498
70670
  disabled: disabled2,
@@ -70505,12 +70677,18 @@ const UnitInput = ({
70505
70677
  value: displayLayer.value,
70506
70678
  onChange: onSetValue,
70507
70679
  onFocus,
70508
- error: error2 || validationError,
70680
+ error: error2,
70509
70681
  warning: warning2,
70510
- right: !left2
70682
+ left: left2,
70683
+ allowEmpty,
70684
+ validationCallback: handleValidationCallback,
70685
+ enableCosmeticRounding,
70686
+ enableDisplayRounding,
70687
+ groupOrder: predefinedOptions ? "middle" : "first",
70688
+ disableInternalErrorValidationMessages
70511
70689
  },
70512
70690
  stringName
70513
- ),
70691
+ ) }),
70514
70692
  displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
70515
70693
  Menu,
70516
70694
  {
@@ -70524,9 +70702,11 @@ const UnitInput = ({
70524
70702
  small: small2,
70525
70703
  sections: alternativeUnits.map(([value2, altUnit, label2]) => {
70526
70704
  const displayUnit = label2 || altUnit || "";
70705
+ const safeValue = !isNaN(Number(value2)) ? value2 : "";
70706
+ const displayValue = enableCosmeticRounding ? roundNumberCosmetic(safeValue) : safeValue;
70527
70707
  return {
70528
70708
  type: "Option",
70529
- label: !isNaN(Number(value2)) ? value2 : "",
70709
+ label: displayValue,
70530
70710
  inline: true,
70531
70711
  onClick: (evt) => {
70532
70712
  evt.stopPropagation();
@@ -70559,78 +70739,108 @@ const convertVisibleRows = ({
70559
70739
  storageUnits,
70560
70740
  onChangeUnit,
70561
70741
  convertBackToStorageUnit,
70562
- convertBackToString,
70563
- enableCosmeticRounding
70742
+ enableCosmeticRounding,
70743
+ enableDisplayRounding
70564
70744
  }) => {
70565
- const convertedHeaders = headers.map((headerRow) => ({
70745
+ const convertedHeaders = headers ? headers.map((headerRow) => ({
70566
70746
  ...headerRow,
70567
70747
  cells: headerRow.cells.map((headerCell) => {
70568
- if (headerCell.type === "AutoUnit") {
70569
- const { unitKey } = headerCell;
70748
+ var _a;
70749
+ if (headerCell.type === CellType.AUTO_UNIT) {
70750
+ const { testId, unitKey } = headerCell;
70570
70751
  return {
70571
70752
  value: selectedUnits[unitKey],
70572
- type: "Select",
70573
- options: getUnitsForQuantity(unitKey),
70574
- native: true,
70575
- onChange: (evt) => onChangeUnit({ unitKey, value: evt.target.value })
70753
+ type: CellType.SELECT,
70754
+ searchable: false,
70755
+ options: (_a = getUnitsForQuantity(unitKey)) == null ? void 0 : _a.map((unit2) => ({
70756
+ label: label$b(unit2),
70757
+ value: unit2
70758
+ })),
70759
+ native: headerCell.native,
70760
+ onChange: (evt) => onChangeUnit({ unitKey, value: evt.target.value }),
70761
+ testId
70576
70762
  };
70577
70763
  }
70578
70764
  return headerCell;
70579
70765
  })
70580
- }));
70581
- const convertedRows = rows.map((row2, rowIndex) => ({
70766
+ })) : [];
70767
+ const convertedRows = rows ? rows.map((row2, rowIndex) => ({
70582
70768
  ...row2,
70583
70769
  cells: row2.cells.map((cell2, cellIndex) => {
70584
- if (cell2.autoUnit) {
70585
- const { formatDisplayValue } = cell2;
70586
- const convertedValue = convertAndGetValue(
70587
- cell2.value,
70588
- selectedUnits[cell2.unitKey],
70589
- storageUnits[cell2.unitKey]
70590
- );
70591
- const displayValue = enableCosmeticRounding ? roundToPrecision(convertedValue, 14) : convertedValue;
70592
- const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(displayValue) : displayValue;
70770
+ if ("autoUnit" in cell2 && (cell2 == null ? void 0 : cell2.autoUnit) && (typeof (cell2 == null ? void 0 : cell2.value) === "string" || typeof (cell2 == null ? void 0 : cell2.value) === "number")) {
70771
+ const { unitKey, value, formatDisplayValue } = cell2;
70772
+ const roundDisplayValue = enableDisplayRounding && "roundDisplayValue" in cell2 ? cell2 == null ? void 0 : cell2.roundDisplayValue : null;
70773
+ const selectedUnit = selectedUnits[unitKey];
70774
+ const storageUnit = storageUnits[unitKey];
70775
+ const unitChanged = selectedUnit !== storageUnit;
70776
+ const convertedValue = unitChanged ? convertAndGetValue(value, selectedUnit, storageUnit) : cell2.value;
70777
+ const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(convertedValue) : convertedValue;
70593
70778
  return {
70594
70779
  ...cell2,
70595
70780
  value: formattedDisplayValue,
70781
+ enableCosmeticRounding: enableCosmeticRounding && unitChanged,
70782
+ //todo: why did we need to check unitChanged here? (original rationale)
70783
+ enableDisplayRounding,
70784
+ roundDisplayValue,
70596
70785
  onChange: (evt) => {
70597
- const { value } = evt.target;
70598
- const { unitKey } = cell2;
70599
- const storageUnit = storageUnits[unitKey];
70600
- const selectedUnit = selectedUnits[unitKey];
70601
- const unitChanged = selectedUnit !== storageUnit;
70602
- const nextValueConverted = unitChanged && convertBackToStorageUnit ? convertAndGetValue(value, storageUnit, selectedUnit) : value;
70603
- const nextValue = convertBackToString ? String(nextValueConverted) : nextValueConverted;
70604
- const nextUnit = convertBackToStorageUnit ? storageUnit : selectedUnit;
70605
- cell2.onChange({
70606
- rowIndex,
70607
- cellIndex,
70608
- value: nextValue,
70609
- unit: nextUnit
70610
- });
70786
+ const { value: value2 } = evt.target;
70787
+ const storageUnit2 = storageUnits[unitKey];
70788
+ const selectedUnit2 = selectedUnits[unitKey];
70789
+ const unitChanged2 = selectedUnit2 !== storageUnit2;
70790
+ const nextUnit = convertBackToStorageUnit ? storageUnit2 : selectedUnit2;
70791
+ const nextValueConverted = unitChanged2 ? convertAndGetValue(value2, nextUnit, selectedUnit2) : value2;
70792
+ if ("onChange" in cell2) {
70793
+ const { onChange } = cell2;
70794
+ const event = {
70795
+ ...evt,
70796
+ target: {
70797
+ ...evt.target,
70798
+ value: String(nextValueConverted),
70799
+ rowIndex,
70800
+ cellIndex,
70801
+ unit: nextUnit
70802
+ }
70803
+ };
70804
+ onChange(event);
70805
+ }
70611
70806
  }
70612
70807
  };
70613
70808
  }
70614
70809
  return cell2;
70615
70810
  })
70616
- }));
70811
+ })) : [];
70617
70812
  return { convertedHeaders, convertedRows };
70618
70813
  };
70619
70814
  const UnitTable = ({
70620
70815
  table: table2,
70621
70816
  unitConfig,
70622
70817
  convertBackToStorageUnit = true,
70623
- convertBackToString = false,
70624
- enableCosmeticRounding = true
70818
+ enableCosmeticRounding = true,
70819
+ enableDisplayRounding = true
70625
70820
  }) => {
70626
- const { rows, headers, otherProps } = table2;
70821
+ const { rows, headers, ...otherProps } = table2;
70627
70822
  const { storageUnits, preferredUnits } = normalizeUnits(unitConfig);
70628
70823
  const previousPreferredUnits = usePrevious(preferredUnits);
70629
70824
  const [selectedUnits, setSelectedUnits] = useState(preferredUnits);
70630
- const onChangeUnit = ({ unitKey, value }) => setSelectedUnits({
70631
- ...selectedUnits,
70632
- [unitKey]: value
70633
- });
70825
+ const onChangeUnit = ({
70826
+ unitKey,
70827
+ value
70828
+ }) => {
70829
+ setSelectedUnits({
70830
+ ...selectedUnits,
70831
+ [unitKey]: value
70832
+ });
70833
+ const specificUnitConfiguration = unitConfig.find(
70834
+ (configuration) => configuration.unitKey === unitKey
70835
+ );
70836
+ if (specificUnitConfiguration && typeof specificUnitConfiguration.onChange === "function") {
70837
+ specificUnitConfiguration.onChange({
70838
+ oldUnit: selectedUnits[unitKey],
70839
+ newUnit: value,
70840
+ unitKey
70841
+ });
70842
+ }
70843
+ };
70634
70844
  const convertViewData = (selectedUnits2) => convertVisibleRows({
70635
70845
  headers,
70636
70846
  rows,
@@ -70638,24 +70848,27 @@ const UnitTable = ({
70638
70848
  storageUnits,
70639
70849
  onChangeUnit,
70640
70850
  convertBackToStorageUnit,
70641
- convertBackToString,
70642
- enableCosmeticRounding
70851
+ enableCosmeticRounding,
70852
+ enableDisplayRounding
70643
70853
  });
70644
70854
  const convertedViewData = convertViewData(selectedUnits);
70645
70855
  const [viewData, setViewData] = useState(convertedViewData);
70646
70856
  useEffect(() => {
70647
70857
  const templateChanged = !isEqual$4(preferredUnits, previousPreferredUnits);
70648
70858
  if (templateChanged) {
70649
- setSelectedUnits(preferredUnits);
70859
+ Object.keys(preferredUnits).forEach((unitKey) => {
70860
+ const oldUnit = previousPreferredUnits == null ? void 0 : previousPreferredUnits[unitKey];
70861
+ const newUnit = preferredUnits[unitKey];
70862
+ if (oldUnit !== newUnit) {
70863
+ onChangeUnit({ unitKey, value: newUnit });
70864
+ }
70865
+ });
70650
70866
  setViewData(convertViewData(preferredUnits));
70651
70867
  }
70652
70868
  }, [unitConfig]);
70653
70869
  useEffect(() => {
70654
70870
  setViewData(convertViewData(selectedUnits));
70655
- }, [table2]);
70656
- useEffect(() => {
70657
- setViewData(convertViewData(selectedUnits));
70658
- }, [selectedUnits]);
70871
+ }, [table2, selectedUnits]);
70659
70872
  return /* @__PURE__ */ jsx(
70660
70873
  Table,
70661
70874
  {
@@ -70667,6 +70880,154 @@ const UnitTable = ({
70667
70880
  }
70668
70881
  );
70669
70882
  };
70883
+ const INTERVAL_TIME = 250;
70884
+ const REQUEST_TIME = 4e4;
70885
+ const FINISH_INTERVALS = 20;
70886
+ const FINISH_TIME = 500;
70887
+ const SmartUploadModal = ({
70888
+ visible,
70889
+ prompt,
70890
+ onCloseModal,
70891
+ onUpload,
70892
+ onComplete,
70893
+ onFailed,
70894
+ onError: onError3,
70895
+ width: width2,
70896
+ heading: heading2,
70897
+ dialogText,
70898
+ fileInputText,
70899
+ fileInputPlaceholder,
70900
+ uploadText,
70901
+ cancelText,
70902
+ testId
70903
+ }) => {
70904
+ const [file, setFile] = useState(null);
70905
+ const [isFetching, setFetching] = useState(false);
70906
+ const [requestTimer, setRequestTimer] = useState(0);
70907
+ let timer = 0;
70908
+ const updateTimer = () => {
70909
+ const newTime = timer + INTERVAL_TIME;
70910
+ timer = newTime;
70911
+ setRequestTimer(timer);
70912
+ };
70913
+ const finishTimer = (deltaTime) => {
70914
+ let newTime = timer + deltaTime;
70915
+ if (newTime >= 0.99 * REQUEST_TIME) {
70916
+ newTime = REQUEST_TIME;
70917
+ }
70918
+ timer = newTime;
70919
+ setRequestTimer(timer);
70920
+ };
70921
+ useEffect(() => {
70922
+ setFile(null);
70923
+ }, [visible]);
70924
+ const handleFileChange = (event) => {
70925
+ if (!event.target.value)
70926
+ return;
70927
+ setFile(event.target.value);
70928
+ };
70929
+ const handleUpload = async () => {
70930
+ setRequestTimer(0);
70931
+ const id2 = setInterval(updateTimer, INTERVAL_TIME);
70932
+ try {
70933
+ if (!file)
70934
+ return;
70935
+ setFetching(true);
70936
+ const data = await onUpload(prompt, file);
70937
+ if (!visible)
70938
+ return;
70939
+ if (data) {
70940
+ clearInterval(id2);
70941
+ const id22 = setInterval(
70942
+ finishTimer,
70943
+ FINISH_TIME / FINISH_INTERVALS,
70944
+ (REQUEST_TIME - timer) / (FINISH_INTERVALS - 1)
70945
+ );
70946
+ setTimeout(() => {
70947
+ onComplete(data);
70948
+ clearInterval(id22);
70949
+ setFetching(false);
70950
+ }, FINISH_TIME);
70951
+ } else {
70952
+ onFailed == null ? void 0 : onFailed();
70953
+ setFetching(false);
70954
+ }
70955
+ } catch (error2) {
70956
+ onError3 == null ? void 0 : onError3(error2);
70957
+ setFetching(false);
70958
+ } finally {
70959
+ clearInterval(id2);
70960
+ }
70961
+ };
70962
+ const onConfirm = () => {
70963
+ handleUpload();
70964
+ };
70965
+ const onClose = () => {
70966
+ onCloseModal();
70967
+ };
70968
+ const content2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
70969
+ /* @__PURE__ */ jsx(Text, { children: dialogText || "Upload file and extract data using a LLM" }),
70970
+ /* @__PURE__ */ jsx(Spacer, {}),
70971
+ /* @__PURE__ */ jsx(
70972
+ FileInput,
70973
+ {
70974
+ placeholder: fileInputPlaceholder || "No file",
70975
+ label: fileInputText || "Select",
70976
+ file: file || void 0,
70977
+ onChange: handleFileChange,
70978
+ testId: `${testId}-file-input`,
70979
+ accept: "image/*"
70980
+ }
70981
+ ),
70982
+ isFetching && /* @__PURE__ */ jsxs(Fragment$1, { children: [
70983
+ /* @__PURE__ */ jsx(Spacer, {}),
70984
+ /* @__PURE__ */ jsx(
70985
+ ProgressBar$1,
70986
+ {
70987
+ percentage: roundByMagnitudeToFixed(
70988
+ 100 * requestTimer / REQUEST_TIME,
70989
+ 3
70990
+ )
70991
+ }
70992
+ )
70993
+ ] })
70994
+ ] });
70995
+ const footer2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
70996
+ /* @__PURE__ */ jsx(
70997
+ Button$1,
70998
+ {
70999
+ label: uploadText || "Upload",
71000
+ colored: true,
71001
+ onClick: onConfirm,
71002
+ disabled: !file || isFetching,
71003
+ testId: `${testId}-button-upload`
71004
+ }
71005
+ ),
71006
+ /* @__PURE__ */ jsx(
71007
+ Button$1,
71008
+ {
71009
+ label: cancelText || "Cancel",
71010
+ onClick: onClose,
71011
+ testId: `${testId}-button-cancel`
71012
+ }
71013
+ )
71014
+ ] });
71015
+ useKeyboardEvent("Escape", () => onClose());
71016
+ return /* @__PURE__ */ jsx(Modal, { visible, centered: true, children: /* @__PURE__ */ jsx(
71017
+ Dialog,
71018
+ {
71019
+ dialog: {
71020
+ scroll: true,
71021
+ heading: heading2 || "Smart Upload",
71022
+ content: content2,
71023
+ footer: footer2,
71024
+ onClose,
71025
+ width: width2 || 350,
71026
+ testId
71027
+ }
71028
+ }
71029
+ ) });
71030
+ };
70670
71031
  export {
70671
71032
  Accordion,
70672
71033
  AccordionWithDefaultToggle,
@@ -70690,6 +71051,7 @@ export {
70690
71051
  ElementType,
70691
71052
  Empty,
70692
71053
  Field,
71054
+ FileButton,
70693
71055
  FileInput,
70694
71056
  Flex,
70695
71057
  FormRow,
@@ -70731,6 +71093,7 @@ export {
70731
71093
  Select,
70732
71094
  SideBar,
70733
71095
  Slider,
71096
+ SmartUploadModal,
70734
71097
  Spacer,
70735
71098
  Spinner$1 as Spinner,
70736
71099
  Table,