@oliasoft-open-source/react-ui-library 4.7.0-beta-1 → 4.7.0-beta-2

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 (214) 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 +131 -22
  6. package/dist/index.html +1 -1
  7. package/dist/index.js +751 -391
  8. package/dist/index.js.map +1 -1
  9. package/dist/storybook/assets/Color-6VNJS4EI-9rJemzwR.js +1 -0
  10. package/dist/storybook/assets/DocsRenderer-NNNQARDV-DP7bJ7AB.js +1 -0
  11. package/dist/storybook/assets/WithTooltip-V3YHNWJZ-eL_Uxnix.js +1 -0
  12. package/dist/storybook/assets/{accordion-6_27SROY.js → accordion-MRdNs3mQ.js} +1 -1
  13. package/dist/storybook/assets/{accordion.stories-Uipdifbl.js → accordion.stories-Ytyr6tn2.js} +2 -2
  14. package/dist/storybook/assets/actions-Z1pyUd57.js +1 -0
  15. package/dist/storybook/assets/actions-_FIB7bOt.css +1 -0
  16. package/dist/storybook/assets/actions.stories-JWaU0QAA.js +1 -0
  17. package/dist/storybook/assets/afe.stories-Ad1-l25x.js +88 -0
  18. package/dist/storybook/assets/badge.stories-2BykvoFl.js +1 -0
  19. package/dist/storybook/assets/blowout.stories--vPM-KpE.js +40 -0
  20. package/dist/storybook/assets/button-UQO14biP.js +1 -0
  21. package/dist/storybook/assets/{button-group-q8QKkLVU.js → button-group-g7HxxHTn.js} +1 -1
  22. package/dist/storybook/assets/{button-group.stories-tLZpLTfD.js → button-group.stories-hJ9V_va5.js} +2 -2
  23. package/dist/storybook/assets/button.stories-ihIU7iUf.js +80 -0
  24. package/dist/storybook/assets/{buttons-and-links-gkg6hOs-.js → buttons-and-links-fv_xHVqw.js} +2 -2
  25. package/dist/storybook/assets/card.stories-5YbTAbLy.js +1 -0
  26. package/dist/storybook/assets/casing-loads.stories-WfK3k-mh.js +209 -0
  27. package/dist/storybook/assets/cell.stories-Xy61z8ka.js +245 -0
  28. package/dist/storybook/assets/{check-box-LZdXXKhv.js → check-box-Q2GsbR79.js} +1 -1
  29. package/dist/storybook/assets/{check-box.stories-0XCykxnz.js → check-box.stories-iQby_Dan.js} +2 -2
  30. package/dist/storybook/assets/{chunk-HLWAVYOI-YF156CNQ.js → chunk-HLWAVYOI-RXldIcZr.js} +1 -1
  31. package/dist/storybook/assets/color-5ySMclFt.js +25 -0
  32. package/dist/storybook/assets/{column.stories-6OLsjlcP.js → column.stories-NnQNzY18.js} +7 -7
  33. package/dist/storybook/assets/dialog-hHTtMGls.js +1 -0
  34. package/dist/storybook/assets/{drawer-WuErQ5Z8.js → drawer-ChY55ghN.js} +1 -1
  35. package/dist/storybook/assets/{drawer.stories-RFRPs_pQ.js → drawer.stories-xv50_UKt.js} +4 -4
  36. package/dist/storybook/assets/empty.stories-dFjUCZln.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-jD6TclDQ.js} +1 -1
  40. package/dist/storybook/assets/{field.stories-RmhJ16HT.js → field.stories-CeHr9rXs.js} +5 -5
  41. package/dist/storybook/assets/file-button.stories-XxMjOBfe.js +10 -0
  42. package/dist/storybook/assets/file-input-A0eGNEgX.js +1 -0
  43. package/dist/storybook/assets/file-input.stories-dM7UFPVo.js +66 -0
  44. package/dist/storybook/assets/{flex.stories-lLz0Xrt_.js → flex.stories-6qFQFEL7.js} +2 -2
  45. package/dist/storybook/assets/footer.stories-4cSc0hBz.js +3 -0
  46. package/dist/storybook/assets/form.stories--Sgi1gUF.js +49 -0
  47. package/dist/storybook/assets/formation.stories-VUtbgcsq.js +74 -0
  48. package/dist/storybook/assets/{formatter-SWP5E3XI-uJi-Y6Jy.js → formatter-SWP5E3XI-qYj9Quey.js} +2 -2
  49. package/dist/storybook/assets/{heading-Bk0bpNfe.js → heading-FcNTpGhR.js} +1 -1
  50. package/dist/storybook/assets/{heading.stories-HLMPkIPo.js → heading.stories-0MJHBHcQ.js} +2 -2
  51. package/dist/storybook/assets/{help-icon--rUDxLUD.js → help-icon-D6ZGAbgL.js} +1 -1
  52. package/dist/storybook/assets/help-icon.stories-YZw5pFQt.js +4 -0
  53. package/dist/storybook/assets/{icon-y1a2N5SZ.js → icon-_m67DAr0.js} +3 -3
  54. package/dist/storybook/assets/icon.stories-2aZia1VV.js +6 -0
  55. package/dist/storybook/assets/iframe-oMAlwWd9.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-_waogfzH.js → index-RhTUHV_k.js} +20 -20
  59. package/dist/storybook/assets/index-VSx05S_2.js +14 -0
  60. package/dist/storybook/assets/index.es-HG2GUH9i.js +79 -0
  61. package/dist/storybook/assets/{input-u1He-wWs.js → input-fYKvBwPs.js} +1 -1
  62. package/dist/storybook/assets/{input-group.stories-WljyIQ0a.js → input-group.stories-ZBffPltv.js} +5 -5
  63. package/dist/storybook/assets/{input-validation-XFS-LWhH.js → input-validation-bb_81fGi.js} +2 -2
  64. package/dist/storybook/assets/{input.stories-rLdDRxtU.js → input.stories-Y5X-JFWU.js} +1 -1
  65. package/dist/storybook/assets/{inputs-vo_nTpyh.js → inputs-MxyGbJ9Y.js} +14 -14
  66. package/dist/storybook/assets/{isPlainObject-4RuU_w9g.js → isPlainObject-OQlD0fAV.js} +1 -1
  67. package/dist/storybook/assets/{label-0_Qf6I8t.js → label-dla_bzHj.js} +1 -1
  68. package/dist/storybook/assets/label.stories-t-e2pWHW.js +11 -0
  69. package/dist/storybook/assets/layout-forms-_uf7qzAu.js +16 -0
  70. package/dist/storybook/assets/{layout-general-QgIJDQ4H.js → layout-general-rHEcWCrx.js} +2 -2
  71. package/dist/storybook/assets/list-Nr0UfaUw.js +8 -0
  72. package/dist/storybook/assets/list.stories-K1nFEsjX.js +478 -0
  73. package/dist/storybook/assets/{list.stories-data-IcFu6vvd.js → list.stories-data-WlepbhE1.js} +1 -1
  74. package/dist/storybook/assets/{loader.stories-0OwmnNML.js → loader.stories-eEBGjVSN.js} +5 -5
  75. package/dist/storybook/assets/menu.stories-nx6w59Nv.js +82 -0
  76. package/dist/storybook/assets/{message-uMHaTEXV.js → message-bbAE2zjv.js} +1 -1
  77. package/dist/storybook/assets/{message.stories-CDgUaLZP.js → message.stories-RJI8haIH.js} +2 -2
  78. package/dist/storybook/assets/meta-content-073TGkSN.js +1 -0
  79. package/dist/storybook/assets/meta-content-dR7AAq04.css +1 -0
  80. package/dist/storybook/assets/modal.stories-rjCFe4Mn.js +200 -0
  81. package/dist/storybook/assets/number-input-xqup0wHW.js +1 -0
  82. package/dist/storybook/assets/number-input.stories-Kzl7Diug.js +153 -0
  83. package/dist/storybook/assets/objectWithoutPropertiesLoose-9Q1jwsKS.js +1 -0
  84. package/dist/storybook/assets/option-dropdown.stories-M9-IYc-K.js +21 -0
  85. package/dist/storybook/assets/{padding-and-spacing-J_Zb8SJm.js → padding-and-spacing-dUA1CCP8.js} +2 -2
  86. package/dist/storybook/assets/page.stories-x7QRBnZm.js +57 -0
  87. package/dist/storybook/assets/{pagination-5n5spTRo.js → pagination-er5fRdi2.js} +1 -1
  88. package/dist/storybook/assets/{pagination.stories-g4a-aSxq.js → pagination.stories-9_uskT8r.js} +2 -2
  89. package/dist/storybook/assets/pop-confirm.stories-QyBm5ZAb.js +9 -0
  90. package/dist/storybook/assets/popover-rJn7kxkX.js +1 -0
  91. package/dist/storybook/assets/popover.stories-5aZN8AoC.js +10 -0
  92. package/dist/storybook/assets/{portal.stories-UGkzdgVk.js → portal.stories-1Jnj3LXz.js} +1 -1
  93. package/dist/storybook/assets/{preview-WIFbPoA-.js → preview-3kPhKzar.js} +13 -13
  94. package/dist/storybook/assets/preview-64tDm6Er.js +7 -0
  95. package/dist/storybook/assets/preview-OnO0tzRj.js +17 -0
  96. package/dist/storybook/assets/projects.stories-wnXCxuJE.js +47 -0
  97. package/dist/storybook/assets/{radio-button-jHcwHUA4.js → radio-button-7TJh5k-h.js} +1 -1
  98. package/dist/storybook/assets/{radio-button.stories-LkCJsp5P.js → radio-button.stories-9mvBu2BH.js} +5 -5
  99. package/dist/storybook/assets/react-router-dom-4Z66xYqZ.js +8 -0
  100. package/dist/storybook/assets/{reservoirs.stories-hhPblhmv.js → reservoirs.stories-XGU7s6pI.js} +2 -2
  101. package/dist/storybook/assets/{rich-text-input.stories-7UzvJ-A1.js → rich-text-input.stories-3Xaavdx_.js} +3 -3
  102. package/dist/storybook/assets/row.stories-Ph7Ckyfn.js +130 -0
  103. package/dist/storybook/assets/{select-JjEPivho.js → select-KWgree43.js} +1 -1
  104. package/dist/storybook/assets/{select.stories-qFDyxRFm.js → select.stories-3D2KkC3_.js} +2 -2
  105. package/dist/storybook/assets/side-bar-kr46QLwI.js +1 -0
  106. package/dist/storybook/assets/side-bar.stories-bJoVvzG5.js +1 -0
  107. package/dist/storybook/assets/{site.stories-QHCzFOnt.js → site.stories-VpsCjYty.js} +2 -2
  108. package/dist/storybook/assets/slider-jx0z5OyT.js +7 -0
  109. package/dist/storybook/assets/slider.stories-CpY4L01U.js +171 -0
  110. package/dist/storybook/assets/smart-upload-modal.stories-hjd4L84J.js +25 -0
  111. package/dist/storybook/assets/spacer.stories-FpDFoVWE.js +1 -0
  112. package/dist/storybook/assets/syntaxhighlighter-B5GMVT5T-1rrvKZrw.js +1 -0
  113. package/dist/storybook/assets/table-4SISWUSt.js +1 -0
  114. package/dist/storybook/assets/table-smKT-hbF.css +1 -0
  115. package/dist/storybook/assets/table.stories-data-UqqhbXjA.js +1 -0
  116. package/dist/storybook/assets/{table.stories-tEvulp9K.js → table.stories-rKzdxDA4.js} +94 -18
  117. package/dist/storybook/assets/{tabs.stories-KtJc5Yci.js → tabs.stories-aps5NXFv.js} +2 -2
  118. package/dist/storybook/assets/text-link.stories-Plmiu8NV.js +14 -0
  119. package/dist/storybook/assets/{textarea-gxvxVBdC.js → textarea-JE26Eekm.js} +1 -1
  120. package/dist/storybook/assets/{textarea.stories-MZHVAwSx.js → textarea.stories-c1mkQU4s.js} +1 -1
  121. package/dist/storybook/assets/tiny-invariant-R4kOKlvx.js +8 -0
  122. package/dist/storybook/assets/title.stories-6AjYBLcL.js +37 -0
  123. package/dist/storybook/assets/{toaster-eOozfa7U.js → toaster-IL_npIpU.js} +1 -1
  124. package/dist/storybook/assets/toaster.stories-QL3_PKZL.js +86 -0
  125. package/dist/storybook/assets/{toggle-BPI2y-lU.js → toggle-vKuY4G3w.js} +1 -1
  126. package/dist/storybook/assets/{toggle.stories-aVmjpons.js → toggle.stories-fJ5QYzcQ.js} +2 -2
  127. package/dist/storybook/assets/{tooltip-HEHiU__l.js → tooltip-dueTLnwA.js} +2 -2
  128. package/dist/storybook/assets/{tooltip.stories-tiOgoWHH.js → tooltip.stories-a_gd0XYu.js} +1 -1
  129. package/dist/storybook/assets/tooltip.test-case.stories-0HiezXaS.js +5 -0
  130. package/dist/storybook/assets/top-bar-K-LdFikH.css +1 -0
  131. package/dist/storybook/assets/top-bar-pptAo2LU.js +1 -0
  132. package/dist/storybook/assets/top-bar.stories-H1OeyQS_.js +21 -0
  133. package/dist/storybook/assets/top-bar.testcase.stories-uJCoeG_m.js +30 -0
  134. package/dist/storybook/assets/tree-U4LtpVm9.css +1 -0
  135. package/dist/storybook/assets/tree.stories-a-UG4OFf.js +182 -0
  136. package/dist/storybook/assets/unit-input-OT-AqIIa.css +1 -0
  137. package/dist/storybook/assets/unit-input.stories--qvPjZnZ.js +349 -0
  138. package/dist/storybook/assets/unit-table.stories-4HlhxSjf.js +150 -0
  139. package/dist/storybook/iframe.html +3 -1
  140. package/dist/storybook/index.json +1 -1
  141. package/dist/storybook/project.json +1 -1
  142. package/dist/storybook/sb-addons/actions-0/manager-bundle.js +1 -1
  143. package/dist/storybook/sb-preview/globals.js +1 -1
  144. package/dist/storybook/sb-preview/runtime.js +19 -19
  145. package/dist/storybook/stories.json +1 -1
  146. package/package.json +10 -9
  147. package/dist/storybook/assets/Color-6VNJS4EI-NPUHt_3q.js +0 -1
  148. package/dist/storybook/assets/DocsRenderer-NNNQARDV-HIEKjKKN.js +0 -1
  149. package/dist/storybook/assets/WithTooltip-4HIR6TLV-XVy3Qn7b.js +0 -1
  150. package/dist/storybook/assets/actions-W12osUP0.css +0 -1
  151. package/dist/storybook/assets/actions-Z9jDWreP.js +0 -1
  152. package/dist/storybook/assets/actions.stories-Qrio9EMy.js +0 -1
  153. package/dist/storybook/assets/afe.stories-mangk6LB.js +0 -88
  154. package/dist/storybook/assets/badge.stories-C0MXS15j.js +0 -1
  155. package/dist/storybook/assets/blowout.stories-i7Ii3760.js +0 -40
  156. package/dist/storybook/assets/button-7V8oA22w.js +0 -1
  157. package/dist/storybook/assets/button.stories-PhWmZXOu.js +0 -71
  158. package/dist/storybook/assets/card.stories-HzHJW6ek.js +0 -1
  159. package/dist/storybook/assets/casing-loads.stories-4eIPrrhL.js +0 -209
  160. package/dist/storybook/assets/cell.stories-X4sboJCw.js +0 -212
  161. package/dist/storybook/assets/color-PIYd2VAw.js +0 -25
  162. package/dist/storybook/assets/dialog-WKHRZcjc.js +0 -1
  163. package/dist/storybook/assets/empty.stories-lva3DbfI.js +0 -1
  164. package/dist/storybook/assets/file-input.stories-SF8BeFpu.js +0 -66
  165. package/dist/storybook/assets/footer.stories-L0qQuABW.js +0 -3
  166. package/dist/storybook/assets/form.stories-qQsjBbOk.js +0 -49
  167. package/dist/storybook/assets/formation.stories-E8DV_cIY.js +0 -74
  168. package/dist/storybook/assets/help-icon.stories-vifwJgNA.js +0 -4
  169. package/dist/storybook/assets/icon.stories-W-UgTWyK.js +0 -6
  170. package/dist/storybook/assets/iframe-NU_z28D3.js +0 -7
  171. package/dist/storybook/assets/index-IQMsp8Ab.js +0 -14
  172. package/dist/storybook/assets/index-gM75B7fB.js +0 -8
  173. package/dist/storybook/assets/index.es-JXn3JM7k.js +0 -86
  174. package/dist/storybook/assets/label.stories-aXdU5_Ql.js +0 -11
  175. package/dist/storybook/assets/layout-forms-w8JJQQqh.js +0 -16
  176. package/dist/storybook/assets/list-8l-RGDgw.js +0 -8
  177. package/dist/storybook/assets/list-heading-Vd3hu5Pf.js +0 -1
  178. package/dist/storybook/assets/list-heading-Y8BAUuV6.css +0 -1
  179. package/dist/storybook/assets/list.stories-Vp0Dm7UU.js +0 -457
  180. package/dist/storybook/assets/menu.stories-VwRF_Pbx.js +0 -60
  181. package/dist/storybook/assets/modal.stories-15sY1c5H.js +0 -173
  182. package/dist/storybook/assets/number-input-SvjJIGsW.js +0 -1
  183. package/dist/storybook/assets/number-input.stories-BURENIFo.js +0 -81
  184. package/dist/storybook/assets/option-dropdown.stories-Q2zd2AcS.js +0 -21
  185. package/dist/storybook/assets/page.stories-pa-9WU0e.js +0 -57
  186. package/dist/storybook/assets/pop-confirm.stories-_agvSFJd.js +0 -9
  187. package/dist/storybook/assets/popover-Y3FpGdUS.js +0 -1
  188. package/dist/storybook/assets/popover.stories-b7Tt4S0j.js +0 -1
  189. package/dist/storybook/assets/preview-D7BEK6_6.js +0 -7
  190. package/dist/storybook/assets/preview-Fi7DQdoQ.js +0 -1
  191. package/dist/storybook/assets/projects.stories-YPlCLdRE.js +0 -47
  192. package/dist/storybook/assets/row.stories-juQv80h3.js +0 -122
  193. package/dist/storybook/assets/side-bar-Fjr2t9MT.js +0 -1
  194. package/dist/storybook/assets/side-bar.stories-sxBJCVnV.js +0 -1
  195. package/dist/storybook/assets/slider-nl2rJ9LF.js +0 -7
  196. package/dist/storybook/assets/slider.stories--aZa8kf-.js +0 -127
  197. package/dist/storybook/assets/spacer.stories-eCrKj4b3.js +0 -1
  198. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI--OA96ou_.js +0 -1
  199. package/dist/storybook/assets/table-PWodWi0p.css +0 -1
  200. package/dist/storybook/assets/table-i8WT9qpj.js +0 -1
  201. package/dist/storybook/assets/table.stories-data-4h6h0P0V.js +0 -1
  202. package/dist/storybook/assets/text-link.stories-kjfUeFtk.js +0 -1
  203. package/dist/storybook/assets/title.stories-cmteB9lx.js +0 -37
  204. package/dist/storybook/assets/toaster.stories-S25S4g_F.js +0 -86
  205. package/dist/storybook/assets/tooltip.test-case.stories-kIeZayHw.js +0 -3
  206. package/dist/storybook/assets/top-bar-9iOkm7Gq.js +0 -1
  207. package/dist/storybook/assets/top-bar-cBtxm6yr.css +0 -1
  208. package/dist/storybook/assets/top-bar.stories-5jcHi3Q_.js +0 -1
  209. package/dist/storybook/assets/top-bar.testcase.stories-7acJvLc_.js +0 -30
  210. package/dist/storybook/assets/tree-zmq4MRb6.css +0 -1
  211. package/dist/storybook/assets/tree.stories-_5t-Rrls.js +0 -128
  212. package/dist/storybook/assets/unit-input-qBUtqoTb.css +0 -1
  213. package/dist/storybook/assets/unit-input.stories-j3Ykteob.js +0 -273
  214. 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,117 @@ const NumberInput = ({
55763
55828
  },
55764
55829
  allowEmpty = false,
55765
55830
  isInTable: isInTable2,
55766
- groupOrder
55831
+ groupOrder,
55832
+ enableCosmeticRounding = true,
55833
+ enableDisplayRounding = false,
55834
+ roundDisplayValue
55767
55835
  }) => {
55768
- const [displayValue, setDisplayValue] = useState(value);
55769
- const [validationError, setValidationError] = useState(null);
55836
+ const inputRef = useRef(null);
55837
+ const [displayValue, setDisplayValue] = useState(String(value));
55838
+ const [focus2, setFocus] = useState(false);
55839
+ const [pristine, setPristine] = useState(true);
55770
55840
  const stringName = getStringName$1(name2);
55771
55841
  const validateInputValue = (value2) => {
55772
- let validation = validateNumber(value2);
55842
+ const validation = validateNumber(value2);
55773
55843
  if (allowEmpty && value2 === "" || validation.valid) {
55774
55844
  return { ...validation, valid: true, errors: void 0 };
55775
55845
  } else {
55776
55846
  return validation;
55777
55847
  }
55778
55848
  };
55849
+ const { valid, errors: errors2 } = validateInputValue(displayValue);
55850
+ const firstError = errors2 && errors2.length ? errors2[0] : null;
55779
55851
  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);
55852
+ setDisplayValue(String(value));
55853
+ }, [value, enableCosmeticRounding, enableDisplayRounding]);
55854
+ useEffect(() => {
55855
+ if (!focus2 && !valid) {
55788
55856
  validationCallback(stringName, firstError);
55857
+ } else {
55858
+ validationCallback(stringName, null);
55789
55859
  }
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 = {
55860
+ }, [focus2, valid, error2]);
55861
+ const onChangeValue = (evt) => {
55862
+ if (valid && !pristine) {
55863
+ const event = {
55800
55864
  ...evt,
55801
55865
  target: {
55802
55866
  ...evt.target,
55803
- value: inputValue,
55867
+ value: String(displayValue),
55804
55868
  name: stringName
55805
55869
  }
55806
55870
  };
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);
55871
+ onChange(event);
55816
55872
  }
55817
55873
  };
55874
+ const onSetValue = (evt) => {
55875
+ const input2 = evt.target;
55876
+ const { value: value2 } = input2;
55877
+ const inputValue = cleanNumStr(
55878
+ value2.replaceAll(" ", "").replaceAll("|", "")
55879
+ );
55880
+ setDisplayValue(inputValue);
55881
+ setPristine(false);
55882
+ };
55883
+ useEffect(() => {
55884
+ if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55885
+ const textInput = inputRef.current;
55886
+ if (textInput) {
55887
+ setTimeout(() => {
55888
+ const { length: length2 } = String(displayValue);
55889
+ textInput.setSelectionRange(length2, length2);
55890
+ }, 0);
55891
+ }
55892
+ }
55893
+ }, [focus2]);
55894
+ const onInputFocus = (evt) => {
55895
+ setFocus(true);
55896
+ onFocus(evt);
55897
+ };
55898
+ const onInputBlur = (evt) => {
55899
+ setFocus(false);
55900
+ onChangeValue(evt);
55901
+ onBlur(evt);
55902
+ };
55903
+ const shouldDisplayRound = enableDisplayRounding && !focus2;
55904
+ const valueWithDisplayRounding = shouldDisplayRound ? roundDisplayValue ? String(roundDisplayValue(displayValue)) : roundToFixed(displayValue, 2) : displayValue;
55905
+ const displayValueEndsWithZero = !!(valueWithDisplayRounding == null ? void 0 : valueWithDisplayRounding.endsWith("0"));
55906
+ const shouldCosmeticallyRound = enableCosmeticRounding && // only when prop is enabled
55907
+ valueWithDisplayRounding && // not when empty typed value
55908
+ !displayValueEndsWithZero && // not when intentionally trying to type trailing zeros as interim values (OW-17109)
55909
+ valid;
55910
+ const valueWithCosmeticRounding = shouldCosmeticallyRound ? roundNumberCosmetic(valueWithDisplayRounding) : valueWithDisplayRounding;
55818
55911
  return /* @__PURE__ */ jsx(
55819
- Input$1,
55912
+ KeyboardEventHandler,
55820
55913
  {
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
55914
+ handleKeys: [EventKey.ENTER],
55915
+ onKeyEvent: (_key, evt) => onChangeValue(evt),
55916
+ children: /* @__PURE__ */ jsx(
55917
+ Input$1,
55918
+ {
55919
+ type: "text",
55920
+ name: stringName,
55921
+ testId,
55922
+ disabled: disabled2,
55923
+ placeholder: placeholder3,
55924
+ value: valueWithCosmeticRounding,
55925
+ onChange: onSetValue,
55926
+ onFocus: onInputFocus,
55927
+ onBlur: onInputBlur,
55928
+ error: !focus2 && (firstError || error2),
55929
+ warning: warning2,
55930
+ right: !left2,
55931
+ small: small2,
55932
+ width: width2,
55933
+ isInTable: isInTable2,
55934
+ groupOrder,
55935
+ tabIndex,
55936
+ tooltip: tooltip2,
55937
+ ref: inputRef
55938
+ },
55939
+ stringName
55940
+ )
55941
+ }
55840
55942
  );
55841
55943
  };
55842
55944
  const NumberInputCell = ({ cell: cell2, testId }) => {
@@ -55849,6 +55951,8 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
55849
55951
  var _a;
55850
55952
  return (_a = cell2.onChange) == null ? void 0 : _a.call(cell2, ev);
55851
55953
  },
55954
+ onFocus: cell2.onFocus,
55955
+ onBlur: cell2.onBlur,
55852
55956
  placeholder: cell2.placeholder,
55853
55957
  error: cell2.error,
55854
55958
  warning: cell2.warning,
@@ -55859,7 +55963,10 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
55859
55963
  testId,
55860
55964
  tooltip: cell2.tooltip,
55861
55965
  validationCallback: cell2.validationCallback,
55862
- allowEmpty: cell2.allowEmpty
55966
+ allowEmpty: cell2.allowEmpty,
55967
+ enableCosmeticRounding: cell2.enableCosmeticRounding,
55968
+ enableDisplayRounding: cell2.enableDisplayRounding,
55969
+ roundDisplayValue: cell2.roundDisplayValue
55863
55970
  }
55864
55971
  );
55865
55972
  };
@@ -55892,6 +55999,7 @@ const SelectCell = ({
55892
55999
  maxTooltipWidth: cell2.maxTooltipWidth,
55893
56000
  width: "100%",
55894
56001
  autoLayerWidth: cell2.autoLayerWidth,
56002
+ multi: cell2.multi,
55895
56003
  right: columnAlignment === Align.RIGHT,
55896
56004
  testId,
55897
56005
  tabIndex: cell2.disabled ? -1 : 0
@@ -56126,6 +56234,7 @@ var CellType = /* @__PURE__ */ ((CellType2) => {
56126
56234
  CellType2["SLIDER"] = "Slider";
56127
56235
  CellType2["CHECKBOX"] = "CheckBox";
56128
56236
  CellType2["ACTIONS"] = "Actions";
56237
+ CellType2["AUTO_UNIT"] = "AutoUnit";
56129
56238
  return CellType2;
56130
56239
  })(CellType || {});
56131
56240
  const Cell = ({
@@ -56208,6 +56317,8 @@ const Row = ({
56208
56317
  onRowMouseEnter,
56209
56318
  onRowMouseLeave,
56210
56319
  expandedContent,
56320
+ error: error2,
56321
+ warning: warning2,
56211
56322
  active: active2
56212
56323
  } = row2;
56213
56324
  const cells = row2.cells.map((c2, i) => {
@@ -56299,7 +56410,9 @@ const Row = ({
56299
56410
  className: cx$2(
56300
56411
  onRowClick && !onRowClick.noStyle ? styles$8.clickableRow : null,
56301
56412
  onRowMouseEnter && !onRowMouseEnter.noStyle ? styles$8.hoverableRow : null,
56302
- active2 ? styles$8.rowActive : null
56413
+ active2 ? styles$8.rowActive : null,
56414
+ error2 ? styles$8.errorRow : null,
56415
+ warning2 ? styles$8.warningRow : null
56303
56416
  ),
56304
56417
  ref: (provided == null ? void 0 : provided.innerRef) || null,
56305
56418
  ...(provided == null ? void 0 : provided.draggableProps) || null,
@@ -56728,9 +56841,20 @@ const TextLink = ({
56728
56841
  href = void 0,
56729
56842
  target = void 0,
56730
56843
  testId,
56731
- onClick
56844
+ onClick,
56845
+ component: Component2 = "a"
56732
56846
  }) => {
56733
- return /* @__PURE__ */ jsx("a", { href, target, onClick, "data-testid": testId, children: /* @__PURE__ */ jsx(Text, { link: true, children }) });
56847
+ return /* @__PURE__ */ jsx(
56848
+ Component2,
56849
+ {
56850
+ href,
56851
+ to: href,
56852
+ target,
56853
+ onClick,
56854
+ "data-testid": testId,
56855
+ children: /* @__PURE__ */ jsx(Text, { link: true, children })
56856
+ }
56857
+ );
56734
56858
  };
56735
56859
  const inputInTable = "_inputInTable_66zck_1";
56736
56860
  const inputHover = "_inputHover_66zck_13";
@@ -57996,22 +58120,22 @@ const Toggle = ({
57996
58120
  }
57997
58121
  );
57998
58122
  };
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";
58123
+ const topbar = "_topbar_oyr59_11";
58124
+ const fixed = "_fixed_oyr59_21";
58125
+ const appSwitcher = "_appSwitcher_oyr59_29";
58126
+ const title = "_title_oyr59_75";
58127
+ const logo = "_logo_oyr59_91";
58128
+ const label = "_label_oyr59_94";
58129
+ const brand = "_brand_oyr59_99";
58130
+ const version = "_version_oyr59_104";
58131
+ const left = "_left_oyr59_111";
58132
+ const right = "_right_oyr59_112";
58133
+ const item = "_item_oyr59_126";
58134
+ const link = "_link_oyr59_127";
58135
+ const button = "_button_oyr59_138";
58136
+ const menu = "_menu_oyr59_139";
58137
+ const active = "_active_oyr59_168";
58138
+ const alert = "_alert_oyr59_193";
58015
58139
  const styles$3 = {
58016
58140
  topbar,
58017
58141
  fixed,
@@ -58069,7 +58193,8 @@ const Link = ({
58069
58193
  onClick,
58070
58194
  active: active2,
58071
58195
  disabled: disabled2,
58072
- testId
58196
+ testId,
58197
+ component: Component2 = "a"
58073
58198
  }) => {
58074
58199
  const disabledContext = useContext(DisabledContext);
58075
58200
  const handleClick2 = (event) => {
@@ -58079,10 +58204,11 @@ const Link = ({
58079
58204
  onClick == null ? void 0 : onClick(event);
58080
58205
  };
58081
58206
  return /* @__PURE__ */ jsxs(
58082
- "a",
58207
+ Component2,
58083
58208
  {
58084
58209
  className: cx$2(styles$3.link, active2 ? styles$3.active : ""),
58085
58210
  href: url || "#",
58211
+ to: url,
58086
58212
  onClick: handleClick2,
58087
58213
  "aria-disabled": disabled2 || disabledContext,
58088
58214
  "data-testid": testId,
@@ -58106,7 +58232,8 @@ const Element$1 = ({ element }) => {
58106
58232
  onClick: element.onClick,
58107
58233
  active: element.active,
58108
58234
  disabled: element.disabled,
58109
- testId: element.testId
58235
+ testId: element.testId,
58236
+ component: element.component
58110
58237
  }
58111
58238
  ) });
58112
58239
  case ElementType.BUTTON:
@@ -69925,12 +70052,12 @@ function TreeInner(props, ref2) {
69925
70052
  );
69926
70053
  }
69927
70054
  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";
70055
+ const tree = "_tree_15yn1_1";
70056
+ const toggle = "_toggle_15yn1_4";
70057
+ const dropTarget = "_dropTarget_15yn1_11";
70058
+ const draggingSource = "_draggingSource_15yn1_26";
70059
+ const placeholderContainer = "_placeholderContainer_15yn1_29";
70060
+ const placeholder2 = "_placeholder_15yn1_29";
69934
70061
  const styles$1 = {
69935
70062
  tree,
69936
70063
  toggle,
@@ -69946,14 +70073,46 @@ const TreeItem = ({
69946
70073
  onToggle,
69947
70074
  hasChild,
69948
70075
  draggable: draggable2,
69949
- icons: icons2
70076
+ icons: icons2,
70077
+ onDrop
69950
70078
  }) => {
69951
70079
  const { id: id2, data } = node2;
69952
70080
  const { active: active2, testId, onClick, actions: actions2 = [] } = data;
70081
+ const [isDragOver, setDragOver] = React__default.useState(false);
70082
+ const [dragOverStartTime, setDragOverStartTime] = React__default.useState(0);
69953
70083
  const handleToggle = (e2) => {
69954
70084
  e2.stopPropagation();
69955
70085
  onToggle(id2);
69956
70086
  };
70087
+ const handleDragEnter = (event) => {
70088
+ event.preventDefault();
70089
+ event.stopPropagation();
70090
+ if (!isDragOver) {
70091
+ setDragOver(true);
70092
+ setDragOverStartTime((/* @__PURE__ */ new Date()).getTime());
70093
+ }
70094
+ };
70095
+ const handleDragLeave = (event) => {
70096
+ event.preventDefault();
70097
+ event.stopPropagation();
70098
+ if ((/* @__PURE__ */ new Date()).getTime() - dragOverStartTime > 20) {
70099
+ setDragOver(false);
70100
+ }
70101
+ };
70102
+ const handleDragOver = (event) => {
70103
+ event.preventDefault();
70104
+ event.stopPropagation();
70105
+ if (hasChild && !isOpen2 && (/* @__PURE__ */ new Date()).getTime() - dragOverStartTime > 200) {
70106
+ handleToggle(event);
70107
+ }
70108
+ };
70109
+ const handleDrop = (event) => {
70110
+ event.preventDefault();
70111
+ event.stopPropagation();
70112
+ setDragOver(false);
70113
+ setDragOverStartTime((/* @__PURE__ */ new Date()).getTime());
70114
+ onDrop == null ? void 0 : onDrop(event);
70115
+ };
69957
70116
  return /* @__PURE__ */ jsx(
69958
70117
  "div",
69959
70118
  {
@@ -69961,7 +70120,8 @@ const TreeItem = ({
69961
70120
  listStyles.item,
69962
70121
  listStyles.action,
69963
70122
  active2 ? listStyles.active : "",
69964
- depth > 0 ? listStyles.indented : ""
70123
+ depth > 0 ? listStyles.indented : "",
70124
+ isDragOver ? listStyles.bordered : ""
69965
70125
  ),
69966
70126
  style: {
69967
70127
  marginInlineStart: depth * 24
@@ -69974,10 +70134,17 @@ const TreeItem = ({
69974
70134
  handleToggle(evt);
69975
70135
  }
69976
70136
  },
70137
+ onDrop: (evt) => onDrop ? handleDrop(evt) : {},
70138
+ onDragEnter: (evt) => onDrop ? handleDragEnter(evt) : {},
70139
+ onDragOver: (evt) => onDrop ? handleDragOver(evt) : {},
70140
+ onDragLeave: (evt) => onDrop ? handleDragLeave(evt) : {},
69977
70141
  children: /* @__PURE__ */ jsxs(
69978
70142
  "div",
69979
70143
  {
69980
- className: listStyles.itemHeader,
70144
+ className: cx$2(
70145
+ listStyles.itemHeader,
70146
+ isDragOver ? listStyles.noPointerEvents : ""
70147
+ ),
69981
70148
  children: [
69982
70149
  hasChild && /* @__PURE__ */ jsx("div", { className: styles$1.toggle, children: /* @__PURE__ */ jsx(
69983
70150
  Button$1,
@@ -70010,35 +70177,89 @@ const Tree = ({
70010
70177
  treeRef,
70011
70178
  itemHasChild,
70012
70179
  onItemToggle,
70013
- icons: icons2
70180
+ icons: icons2,
70181
+ allowParentReassignment
70014
70182
  }) => {
70015
70183
  var _a;
70016
- const handleDrop = (newTree) => {
70017
- if (onListReorder) {
70018
- const newList = newTree.map(({ id: id2, parent, droppable: droppable2, data }) => ({
70184
+ const handleOpen = (id2) => {
70185
+ if (onChangeOpen) {
70186
+ onChangeOpen(id2);
70187
+ }
70188
+ };
70189
+ const findNodeIndexById = (tree22, id2) => {
70190
+ return (tree22 == null ? void 0 : tree22.findIndex((node2) => (node2 == null ? void 0 : node2.id) === id2)) ?? -1;
70191
+ };
70192
+ const setDragSourceParentToGrandparent = (dragSource, workingTree) => {
70193
+ const dragSourceParentIndex = findNodeIndexById(
70194
+ workingTree,
70195
+ dragSource == null ? void 0 : dragSource.parent
70196
+ );
70197
+ if (dragSourceParentIndex >= 0) {
70198
+ const grandparent = workingTree == null ? void 0 : workingTree.find(
70199
+ (node2) => {
70200
+ var _a2;
70201
+ return (node2 == null ? void 0 : node2.id) === ((_a2 = workingTree[dragSourceParentIndex]) == null ? void 0 : _a2.parent);
70202
+ }
70203
+ );
70204
+ dragSource.parent = grandparent ? grandparent.id : 0;
70205
+ }
70206
+ };
70207
+ const removeDragSourceFromWorkingTree = (dragSource, workingTree) => {
70208
+ return (workingTree == null ? void 0 : workingTree.filter((node2) => (node2 == null ? void 0 : node2.id) !== (dragSource == null ? void 0 : dragSource.id))) ?? [];
70209
+ };
70210
+ const insertDragSourceAfterParentInWorkingTree = (dragSource, dragSourceParentIndex, workingTree) => {
70211
+ workingTree == null ? void 0 : workingTree.splice(dragSourceParentIndex, 0, dragSource);
70212
+ return workingTree;
70213
+ };
70214
+ const transformTreeToList = (tree22) => {
70215
+ return tree22.map(({ id: id2, parent, droppable: droppable2, data }) => {
70216
+ return {
70019
70217
  id: id2,
70020
70218
  parent,
70021
70219
  droppable: droppable2,
70022
70220
  ...data
70023
- }));
70024
- onListReorder(newList);
70025
- }
70221
+ };
70222
+ });
70026
70223
  };
70027
- const handleOpen = (id2) => {
70028
- if (onChangeOpen) {
70029
- onChangeOpen(id2);
70224
+ const handleDrop = (newTree, option2) => {
70225
+ const { dragSource, dropTarget: dropTarget2 } = option2;
70226
+ let workingTree = [...newTree];
70227
+ if (!onListReorder)
70228
+ return;
70229
+ const dragSourceIndex = findNodeIndexById(workingTree, dragSource == null ? void 0 : dragSource.id);
70230
+ const dragSourceParentIndex = findNodeIndexById(
70231
+ workingTree,
70232
+ dragSource == null ? void 0 : dragSource.parent
70233
+ );
70234
+ let newList = [];
70235
+ if ((dragSource == null ? void 0 : dragSource.parent) === (dropTarget2 == null ? void 0 : dropTarget2.id) && dragSourceIndex === 0 && allowParentReassignment) {
70236
+ setDragSourceParentToGrandparent(dragSource, workingTree);
70237
+ workingTree = removeDragSourceFromWorkingTree(
70238
+ dragSource,
70239
+ workingTree
70240
+ );
70241
+ workingTree = insertDragSourceAfterParentInWorkingTree(
70242
+ dragSource,
70243
+ dragSourceParentIndex,
70244
+ workingTree
70245
+ );
70030
70246
  }
70247
+ newList = transformTreeToList(workingTree);
70248
+ onListReorder(newList);
70031
70249
  };
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
- }));
70250
+ const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(
70251
+ ({ id: id2, droppable: droppable2, parent, name: name2, onDrop, ...rest }) => ({
70252
+ id: id2,
70253
+ text: name2,
70254
+ droppable: droppable2,
70255
+ parent,
70256
+ data: {
70257
+ name: name2,
70258
+ onDrop,
70259
+ ...rest
70260
+ }
70261
+ })
70262
+ );
70042
70263
  return /* @__PURE__ */ jsxs("div", { "data-testid": testId, children: [
70043
70264
  list2.name && !list2.noHeader && /* @__PURE__ */ jsx(ListHeading, { name: list2.name, actions: list2.actions }),
70044
70265
  /* @__PURE__ */ jsx("div", { className: listStyles.list, children: /* @__PURE__ */ jsx(
@@ -70062,6 +70283,7 @@ const Tree = ({
70062
70283
  },
70063
70284
  rootId: 0,
70064
70285
  render: (node2, { depth, isOpen: isOpen2, onToggle, hasChild }) => {
70286
+ var _a2;
70065
70287
  return /* @__PURE__ */ jsx(
70066
70288
  TreeItem,
70067
70289
  {
@@ -70074,7 +70296,8 @@ const Tree = ({
70074
70296
  onToggle();
70075
70297
  },
70076
70298
  draggable: draggable2,
70077
- icons: icons2
70299
+ icons: icons2,
70300
+ onDrop: (_a2 = node2.data) == null ? void 0 : _a2.onDrop
70078
70301
  }
70079
70302
  );
70080
70303
  },
@@ -70175,45 +70398,6 @@ const getStringName = (name2) => {
70175
70398
  }
70176
70399
  return typeof name2 === "string" ? name2 : "";
70177
70400
  };
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
70401
  const isUnitKnown = (unit2 = "") => {
70218
70402
  var _a;
70219
70403
  return (_a = KNOWN_UNITS) == null ? void 0 : _a.includes(unit2);
@@ -70222,16 +70406,18 @@ const isKnownUnit = (valueWithUnit, defaultUnit) => {
70222
70406
  const unitFromValue = getUnit(valueWithUnit || "");
70223
70407
  return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
70224
70408
  };
70225
- const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
70409
+ const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
70410
+ const inputWrapper = "_inputWrapper_ye9w9_4";
70226
70411
  const styles = {
70227
- predefinedMenuActive
70412
+ predefinedMenuActive,
70413
+ inputWrapper
70228
70414
  };
70229
70415
  const UnitInput = ({
70230
70416
  name: name2,
70231
70417
  placeholder: placeholder3 = "",
70232
70418
  disabled: disabled2 = false,
70233
70419
  disabledUnit = false,
70234
- error: error2 = null,
70420
+ error: error2 = false,
70235
70421
  left: left2 = false,
70236
70422
  small: small2 = false,
70237
70423
  width: width2 = "100%",
@@ -70250,15 +70436,18 @@ const UnitInput = ({
70250
70436
  unitTemplate,
70251
70437
  doNotConvertValue = false,
70252
70438
  testId,
70253
- warning: warning2 = null,
70439
+ warning: warning2 = false,
70254
70440
  predefinedOptions,
70255
70441
  initialPredefinedOption = false,
70256
70442
  shouldLinkAutomaticly = true,
70257
70443
  selectedPredefinedOptionKey,
70258
- validationCallback = () => ({ name: "", error: null }),
70444
+ validationCallback,
70259
70445
  disabledValidation = false,
70260
70446
  allowEmpty = false,
70261
- autoValue
70447
+ autoValue,
70448
+ convertBackToStorageUnit = false,
70449
+ enableCosmeticRounding = true,
70450
+ enableDisplayRounding = false
70262
70451
  }) => {
70263
70452
  if (typeof value === "number") {
70264
70453
  value = `${value}`;
@@ -70287,7 +70476,6 @@ const UnitInput = ({
70287
70476
  );
70288
70477
  const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70289
70478
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70290
- const [validationError, setValidationError] = useState(null);
70291
70479
  const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
70292
70480
  initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70293
70481
  );
@@ -70320,33 +70508,16 @@ const UnitInput = ({
70320
70508
  const stringName2 = getStringName(name2);
70321
70509
  const input2 = evt.target;
70322
70510
  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
70511
+ const newValue = withUnit(inputValue, (displayLayer == null ? void 0 : displayLayer.unit) || "");
70512
+ const returnValue = convertBackToStorageUnit ? withUnit(convertAndGetValue(newValue, propUnit), propUnit) : newValue;
70513
+ onChange({
70514
+ target: {
70515
+ value: returnValue,
70516
+ name: stringName2
70517
+ }
70333
70518
  });
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
- }
70519
+ const [val, u] = split$1(newValue);
70520
+ setDisplayLayer({ value: val, unit: u });
70350
70521
  runAfterUpdate(() => {
70351
70522
  input2.selectionStart = currentCursorPosition;
70352
70523
  input2.selectionEnd = currentCursorPosition;
@@ -70392,14 +70563,6 @@ const UnitInput = ({
70392
70563
  }
70393
70564
  }
70394
70565
  }
70395
- const cleanValue = checkAndCleanDecimalComma(propValue);
70396
- const errorMessage = validate(cleanValue, {
70397
- allowEmpty,
70398
- autoValue,
70399
- placeholder: placeholder3,
70400
- disabledValidation
70401
- });
70402
- setValidationError(errorMessage);
70403
70566
  }, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
70404
70567
  const alternativeUnits = getAlternativeUnits();
70405
70568
  const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
@@ -70433,6 +70596,14 @@ const UnitInput = ({
70433
70596
  selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
70434
70597
  };
70435
70598
  };
70599
+ const handleValidationCallback = (name22, error22) => {
70600
+ if (validationCallback) {
70601
+ validationCallback({
70602
+ name: name22,
70603
+ error: error22
70604
+ });
70605
+ }
70606
+ };
70436
70607
  sectionsPredefinedMenu = [
70437
70608
  {
70438
70609
  type: MenuType.OPTION,
@@ -70489,10 +70660,9 @@ const UnitInput = ({
70489
70660
  )
70490
70661
  }
70491
70662
  ),
70492
- /* @__PURE__ */ jsx(
70493
- Input$1,
70663
+ /* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
70664
+ NumberInput,
70494
70665
  {
70495
- type: "text",
70496
70666
  name: stringName,
70497
70667
  testId,
70498
70668
  disabled: disabled2,
@@ -70505,12 +70675,17 @@ const UnitInput = ({
70505
70675
  value: displayLayer.value,
70506
70676
  onChange: onSetValue,
70507
70677
  onFocus,
70508
- error: error2 || validationError,
70678
+ error: error2,
70509
70679
  warning: warning2,
70510
- right: !left2
70680
+ left: left2,
70681
+ allowEmpty,
70682
+ validationCallback: handleValidationCallback,
70683
+ enableCosmeticRounding,
70684
+ enableDisplayRounding,
70685
+ groupOrder: predefinedOptions ? "middle" : "first"
70511
70686
  },
70512
70687
  stringName
70513
- ),
70688
+ ) }),
70514
70689
  displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
70515
70690
  Menu,
70516
70691
  {
@@ -70524,9 +70699,11 @@ const UnitInput = ({
70524
70699
  small: small2,
70525
70700
  sections: alternativeUnits.map(([value2, altUnit, label2]) => {
70526
70701
  const displayUnit = label2 || altUnit || "";
70702
+ const safeValue = !isNaN(Number(value2)) ? value2 : "";
70703
+ const displayValue = enableCosmeticRounding ? roundNumberCosmetic(safeValue) : safeValue;
70527
70704
  return {
70528
70705
  type: "Option",
70529
- label: !isNaN(Number(value2)) ? value2 : "",
70706
+ label: displayValue,
70530
70707
  inline: true,
70531
70708
  onClick: (evt) => {
70532
70709
  evt.stopPropagation();
@@ -70559,78 +70736,108 @@ const convertVisibleRows = ({
70559
70736
  storageUnits,
70560
70737
  onChangeUnit,
70561
70738
  convertBackToStorageUnit,
70562
- convertBackToString,
70563
- enableCosmeticRounding
70739
+ enableCosmeticRounding,
70740
+ enableDisplayRounding
70564
70741
  }) => {
70565
- const convertedHeaders = headers.map((headerRow) => ({
70742
+ const convertedHeaders = headers ? headers.map((headerRow) => ({
70566
70743
  ...headerRow,
70567
70744
  cells: headerRow.cells.map((headerCell) => {
70568
- if (headerCell.type === "AutoUnit") {
70569
- const { unitKey } = headerCell;
70745
+ var _a;
70746
+ if (headerCell.type === CellType.AUTO_UNIT) {
70747
+ const { testId, unitKey } = headerCell;
70570
70748
  return {
70571
70749
  value: selectedUnits[unitKey],
70572
- type: "Select",
70573
- options: getUnitsForQuantity(unitKey),
70574
- native: true,
70575
- onChange: (evt) => onChangeUnit({ unitKey, value: evt.target.value })
70750
+ type: CellType.SELECT,
70751
+ searchable: false,
70752
+ options: (_a = getUnitsForQuantity(unitKey)) == null ? void 0 : _a.map((unit2) => ({
70753
+ label: label$b(unit2),
70754
+ value: unit2
70755
+ })),
70756
+ native: headerCell.native,
70757
+ onChange: (evt) => onChangeUnit({ unitKey, value: evt.target.value }),
70758
+ testId
70576
70759
  };
70577
70760
  }
70578
70761
  return headerCell;
70579
70762
  })
70580
- }));
70581
- const convertedRows = rows.map((row2, rowIndex) => ({
70763
+ })) : [];
70764
+ const convertedRows = rows ? rows.map((row2, rowIndex) => ({
70582
70765
  ...row2,
70583
70766
  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;
70767
+ 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")) {
70768
+ const { unitKey, value, formatDisplayValue } = cell2;
70769
+ const roundDisplayValue = enableDisplayRounding && "roundDisplayValue" in cell2 ? cell2 == null ? void 0 : cell2.roundDisplayValue : null;
70770
+ const selectedUnit = selectedUnits[unitKey];
70771
+ const storageUnit = storageUnits[unitKey];
70772
+ const unitChanged = selectedUnit !== storageUnit;
70773
+ const convertedValue = unitChanged ? convertAndGetValue(value, selectedUnit, storageUnit) : cell2.value;
70774
+ const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(convertedValue) : convertedValue;
70593
70775
  return {
70594
70776
  ...cell2,
70595
70777
  value: formattedDisplayValue,
70778
+ enableCosmeticRounding: enableCosmeticRounding && unitChanged,
70779
+ //todo: why did we need to check unitChanged here? (original rationale)
70780
+ enableDisplayRounding,
70781
+ roundDisplayValue,
70596
70782
  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
- });
70783
+ const { value: value2 } = evt.target;
70784
+ const storageUnit2 = storageUnits[unitKey];
70785
+ const selectedUnit2 = selectedUnits[unitKey];
70786
+ const unitChanged2 = selectedUnit2 !== storageUnit2;
70787
+ const nextUnit = convertBackToStorageUnit ? storageUnit2 : selectedUnit2;
70788
+ const nextValueConverted = unitChanged2 ? convertAndGetValue(value2, nextUnit, selectedUnit2) : value2;
70789
+ if ("onChange" in cell2) {
70790
+ const { onChange } = cell2;
70791
+ const event = {
70792
+ ...evt,
70793
+ target: {
70794
+ ...evt.target,
70795
+ value: String(nextValueConverted),
70796
+ rowIndex,
70797
+ cellIndex,
70798
+ unit: nextUnit
70799
+ }
70800
+ };
70801
+ onChange(event);
70802
+ }
70611
70803
  }
70612
70804
  };
70613
70805
  }
70614
70806
  return cell2;
70615
70807
  })
70616
- }));
70808
+ })) : [];
70617
70809
  return { convertedHeaders, convertedRows };
70618
70810
  };
70619
70811
  const UnitTable = ({
70620
70812
  table: table2,
70621
70813
  unitConfig,
70622
70814
  convertBackToStorageUnit = true,
70623
- convertBackToString = false,
70624
- enableCosmeticRounding = true
70815
+ enableCosmeticRounding = true,
70816
+ enableDisplayRounding = true
70625
70817
  }) => {
70626
- const { rows, headers, otherProps } = table2;
70818
+ const { rows, headers, ...otherProps } = table2;
70627
70819
  const { storageUnits, preferredUnits } = normalizeUnits(unitConfig);
70628
70820
  const previousPreferredUnits = usePrevious(preferredUnits);
70629
70821
  const [selectedUnits, setSelectedUnits] = useState(preferredUnits);
70630
- const onChangeUnit = ({ unitKey, value }) => setSelectedUnits({
70631
- ...selectedUnits,
70632
- [unitKey]: value
70633
- });
70822
+ const onChangeUnit = ({
70823
+ unitKey,
70824
+ value
70825
+ }) => {
70826
+ setSelectedUnits({
70827
+ ...selectedUnits,
70828
+ [unitKey]: value
70829
+ });
70830
+ const specificUnitConfiguration = unitConfig.find(
70831
+ (configuration) => configuration.unitKey === unitKey
70832
+ );
70833
+ if (specificUnitConfiguration && typeof specificUnitConfiguration.onChange === "function") {
70834
+ specificUnitConfiguration.onChange({
70835
+ oldUnit: selectedUnits[unitKey],
70836
+ newUnit: value,
70837
+ unitKey
70838
+ });
70839
+ }
70840
+ };
70634
70841
  const convertViewData = (selectedUnits2) => convertVisibleRows({
70635
70842
  headers,
70636
70843
  rows,
@@ -70638,24 +70845,27 @@ const UnitTable = ({
70638
70845
  storageUnits,
70639
70846
  onChangeUnit,
70640
70847
  convertBackToStorageUnit,
70641
- convertBackToString,
70642
- enableCosmeticRounding
70848
+ enableCosmeticRounding,
70849
+ enableDisplayRounding
70643
70850
  });
70644
70851
  const convertedViewData = convertViewData(selectedUnits);
70645
70852
  const [viewData, setViewData] = useState(convertedViewData);
70646
70853
  useEffect(() => {
70647
70854
  const templateChanged = !isEqual$4(preferredUnits, previousPreferredUnits);
70648
70855
  if (templateChanged) {
70649
- setSelectedUnits(preferredUnits);
70856
+ Object.keys(preferredUnits).forEach((unitKey) => {
70857
+ const oldUnit = previousPreferredUnits == null ? void 0 : previousPreferredUnits[unitKey];
70858
+ const newUnit = preferredUnits[unitKey];
70859
+ if (oldUnit !== newUnit) {
70860
+ onChangeUnit({ unitKey, value: newUnit });
70861
+ }
70862
+ });
70650
70863
  setViewData(convertViewData(preferredUnits));
70651
70864
  }
70652
70865
  }, [unitConfig]);
70653
70866
  useEffect(() => {
70654
70867
  setViewData(convertViewData(selectedUnits));
70655
- }, [table2]);
70656
- useEffect(() => {
70657
- setViewData(convertViewData(selectedUnits));
70658
- }, [selectedUnits]);
70868
+ }, [table2, selectedUnits]);
70659
70869
  return /* @__PURE__ */ jsx(
70660
70870
  Table,
70661
70871
  {
@@ -70667,6 +70877,154 @@ const UnitTable = ({
70667
70877
  }
70668
70878
  );
70669
70879
  };
70880
+ const INTERVAL_TIME = 250;
70881
+ const REQUEST_TIME = 4e4;
70882
+ const FINISH_INTERVALS = 20;
70883
+ const FINISH_TIME = 500;
70884
+ const SmartUploadModal = ({
70885
+ visible,
70886
+ prompt,
70887
+ onCloseModal,
70888
+ onUpload,
70889
+ onComplete,
70890
+ onFailed,
70891
+ onError: onError3,
70892
+ width: width2,
70893
+ heading: heading2,
70894
+ dialogText,
70895
+ fileInputText,
70896
+ fileInputPlaceholder,
70897
+ uploadText,
70898
+ cancelText,
70899
+ testId
70900
+ }) => {
70901
+ const [file, setFile] = useState(null);
70902
+ const [isFetching, setFetching] = useState(false);
70903
+ const [requestTimer, setRequestTimer] = useState(0);
70904
+ let timer = 0;
70905
+ const updateTimer = () => {
70906
+ const newTime = timer + INTERVAL_TIME;
70907
+ timer = newTime;
70908
+ setRequestTimer(timer);
70909
+ };
70910
+ const finishTimer = (deltaTime) => {
70911
+ let newTime = timer + deltaTime;
70912
+ if (newTime >= 0.99 * REQUEST_TIME) {
70913
+ newTime = REQUEST_TIME;
70914
+ }
70915
+ timer = newTime;
70916
+ setRequestTimer(timer);
70917
+ };
70918
+ useEffect(() => {
70919
+ setFile(null);
70920
+ }, [visible]);
70921
+ const handleFileChange = (event) => {
70922
+ if (!event.target.value)
70923
+ return;
70924
+ setFile(event.target.value);
70925
+ };
70926
+ const handleUpload = async () => {
70927
+ setRequestTimer(0);
70928
+ const id2 = setInterval(updateTimer, INTERVAL_TIME);
70929
+ try {
70930
+ if (!file)
70931
+ return;
70932
+ setFetching(true);
70933
+ const data = await onUpload(prompt, file);
70934
+ if (!visible)
70935
+ return;
70936
+ if (data) {
70937
+ clearInterval(id2);
70938
+ const id22 = setInterval(
70939
+ finishTimer,
70940
+ FINISH_TIME / FINISH_INTERVALS,
70941
+ (REQUEST_TIME - timer) / (FINISH_INTERVALS - 1)
70942
+ );
70943
+ setTimeout(() => {
70944
+ onComplete(data);
70945
+ clearInterval(id22);
70946
+ setFetching(false);
70947
+ }, FINISH_TIME);
70948
+ } else {
70949
+ onFailed == null ? void 0 : onFailed();
70950
+ setFetching(false);
70951
+ }
70952
+ } catch (error2) {
70953
+ onError3 == null ? void 0 : onError3(error2);
70954
+ setFetching(false);
70955
+ } finally {
70956
+ clearInterval(id2);
70957
+ }
70958
+ };
70959
+ const onConfirm = () => {
70960
+ handleUpload();
70961
+ };
70962
+ const onClose = () => {
70963
+ onCloseModal();
70964
+ };
70965
+ const content2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
70966
+ /* @__PURE__ */ jsx(Text, { children: dialogText || "Upload file and extract data using a LLM" }),
70967
+ /* @__PURE__ */ jsx(Spacer, {}),
70968
+ /* @__PURE__ */ jsx(
70969
+ FileInput,
70970
+ {
70971
+ placeholder: fileInputPlaceholder || "No file",
70972
+ label: fileInputText || "Select",
70973
+ file: file || void 0,
70974
+ onChange: handleFileChange,
70975
+ testId: `${testId}-file-input`,
70976
+ accept: "image/*"
70977
+ }
70978
+ ),
70979
+ isFetching && /* @__PURE__ */ jsxs(Fragment$1, { children: [
70980
+ /* @__PURE__ */ jsx(Spacer, {}),
70981
+ /* @__PURE__ */ jsx(
70982
+ ProgressBar$1,
70983
+ {
70984
+ percentage: roundByMagnitudeToFixed(
70985
+ 100 * requestTimer / REQUEST_TIME,
70986
+ 3
70987
+ )
70988
+ }
70989
+ )
70990
+ ] })
70991
+ ] });
70992
+ const footer2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
70993
+ /* @__PURE__ */ jsx(
70994
+ Button$1,
70995
+ {
70996
+ label: uploadText || "Upload",
70997
+ colored: true,
70998
+ onClick: onConfirm,
70999
+ disabled: !file || isFetching,
71000
+ testId: `${testId}-button-upload`
71001
+ }
71002
+ ),
71003
+ /* @__PURE__ */ jsx(
71004
+ Button$1,
71005
+ {
71006
+ label: cancelText || "Cancel",
71007
+ onClick: onClose,
71008
+ testId: `${testId}-button-cancel`
71009
+ }
71010
+ )
71011
+ ] });
71012
+ useKeyboardEvent("Escape", () => onClose());
71013
+ return /* @__PURE__ */ jsx(Modal, { visible, centered: true, children: /* @__PURE__ */ jsx(
71014
+ Dialog,
71015
+ {
71016
+ dialog: {
71017
+ scroll: true,
71018
+ heading: heading2 || "Smart Upload",
71019
+ content: content2,
71020
+ footer: footer2,
71021
+ onClose,
71022
+ width: width2 || 350,
71023
+ testId
71024
+ }
71025
+ }
71026
+ ) });
71027
+ };
70670
71028
  export {
70671
71029
  Accordion,
70672
71030
  AccordionWithDefaultToggle,
@@ -70690,6 +71048,7 @@ export {
70690
71048
  ElementType,
70691
71049
  Empty,
70692
71050
  Field,
71051
+ FileButton,
70693
71052
  FileInput,
70694
71053
  Flex,
70695
71054
  FormRow,
@@ -70731,6 +71090,7 @@ export {
70731
71090
  Select,
70732
71091
  SideBar,
70733
71092
  Slider,
71093
+ SmartUploadModal,
70734
71094
  Spacer,
70735
71095
  Spinner$1 as Spinner,
70736
71096
  Table,