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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/404.html +1 -0
  2. package/dist/assets/{index-AkeNwthw.css → index-2LJjuVRB.css} +145 -115
  3. package/dist/assets/{index-neKlYvgy.js → index-kDrJq_kq.js} +226 -102
  4. package/dist/global.css +145 -115
  5. package/dist/index.d.ts +75 -6
  6. package/dist/index.html +1 -1
  7. package/dist/index.js +347 -97
  8. package/dist/index.js.map +1 -1
  9. package/dist/storybook/assets/{Color-6VNJS4EI-GxhKC8e4.js → Color-6VNJS4EI-7SF_QHKQ.js} +1 -1
  10. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-qNtI0g6x.js → DocsRenderer-NNNQARDV-zFqyxzyz.js} +1 -1
  11. package/dist/storybook/assets/{WithTooltip-4HIR6TLV-Oz_GUhfl.js → WithTooltip-4HIR6TLV--mlcCTTj.js} +1 -1
  12. package/dist/storybook/assets/{accordion-6_27SROY.js → accordion-MRdNs3mQ.js} +1 -1
  13. package/dist/storybook/assets/{accordion.stories-DAmwlTmm.js → accordion.stories-3sqRwqly.js} +2 -2
  14. package/dist/storybook/assets/actions-AZ9fI-GM.js +1 -0
  15. package/dist/storybook/assets/actions.stories-DcHBD8wo.js +1 -0
  16. package/dist/storybook/assets/afe.stories-ArA2txnu.js +88 -0
  17. package/dist/storybook/assets/badge.stories-5O4TV4St.js +1 -0
  18. package/dist/storybook/assets/blowout.stories-6yWu_xKW.js +40 -0
  19. package/dist/storybook/assets/{button-group-KeeGgC4K.js → button-group-O6Di9sNA.js} +1 -1
  20. package/dist/storybook/assets/{button-group.stories-DG3i2d7K.js → button-group.stories-2yCzCoPD.js} +2 -2
  21. package/dist/storybook/assets/button-rm22C2wf.js +1 -0
  22. package/dist/storybook/assets/button.stories-32q2fViV.js +80 -0
  23. package/dist/storybook/assets/{buttons-and-links-e5muuefU.js → buttons-and-links-LEUVLdX3.js} +2 -2
  24. package/dist/storybook/assets/card.stories-v_QIHoI3.js +1 -0
  25. package/dist/storybook/assets/{casing-loads.stories--oHbAVn4.js → casing-loads.stories-rcooFkDL.js} +2 -2
  26. package/dist/storybook/assets/{cell.stories-nm3Q_0D8.js → cell.stories-MEK7F8sN.js} +2 -2
  27. package/dist/storybook/assets/{check-box-BX5dfQFk.js → check-box-7DccPNCs.js} +1 -1
  28. package/dist/storybook/assets/{check-box.stories-FNs72smP.js → check-box.stories-QBPARD7M.js} +2 -2
  29. package/dist/storybook/assets/{chunk-HLWAVYOI-IpxCdjQR.js → chunk-HLWAVYOI-XeHb_zS2.js} +1 -1
  30. package/dist/storybook/assets/color-fUhGriLa.js +25 -0
  31. package/dist/storybook/assets/{column.stories-5pd3N4bE.js → column.stories-FWqVDX5B.js} +4 -4
  32. package/dist/storybook/assets/{dialog-dekS0lUR.js → dialog-VIWX250Q.js} +1 -1
  33. package/dist/storybook/assets/{drawer-TM-jK3WR.js → drawer-FAo1Q_ET.js} +1 -1
  34. package/dist/storybook/assets/{drawer.stories-OE24f2Y4.js → drawer.stories-raVCT-8R.js} +4 -4
  35. package/dist/storybook/assets/empty.stories-eLsVeLsD.js +1 -0
  36. package/dist/storybook/assets/{field-kOZPBHf6.js → field-9udMeZdr.js} +1 -1
  37. package/dist/storybook/assets/{field.stories-aEccauPi.js → field.stories-H98nslNw.js} +2 -2
  38. package/dist/storybook/assets/file-input.stories-d--B8cOO.js +66 -0
  39. package/dist/storybook/assets/{flex.stories-rDfMJbP6.js → flex.stories-I4p46kT6.js} +2 -2
  40. package/dist/storybook/assets/footer.stories-Mrr_R3r9.js +3 -0
  41. package/dist/storybook/assets/form.stories-6S2hx2wh.js +49 -0
  42. package/dist/storybook/assets/formation.stories-pE9W1lT-.js +74 -0
  43. package/dist/storybook/assets/{formatter-SWP5E3XI-8JJuES-v.js → formatter-SWP5E3XI-DSCJOjJG.js} +1 -1
  44. package/dist/storybook/assets/{heading-cUVItwKq.js → heading-sY0SLHoQ.js} +1 -1
  45. package/dist/storybook/assets/{heading.stories-UJlMVVI-.js → heading.stories-zStr3-HL.js} +2 -2
  46. package/dist/storybook/assets/{help-icon-nI9A506M.js → help-icon-yrJgkgdC.js} +1 -1
  47. package/dist/storybook/assets/help-icon.stories-gjzAU_pF.js +4 -0
  48. package/dist/storybook/assets/hoist-non-react-statics.cjs-pnyno-Dk.js +8 -0
  49. package/dist/storybook/assets/{icon-y1a2N5SZ.js → icon-_m67DAr0.js} +3 -3
  50. package/dist/storybook/assets/icon.stories-jaMoeuyt.js +6 -0
  51. package/dist/storybook/assets/iframe-5vkaUfcR.js +7 -0
  52. package/dist/storybook/assets/{index-txtTsAry.js → index-abKsB-Kl.js} +5 -5
  53. package/dist/storybook/assets/index-qZmQ7nA9.js +14 -0
  54. package/dist/storybook/assets/index.es-LXZC0YVN.js +79 -0
  55. package/dist/storybook/assets/{input-group.stories-EouZEW-v.js → input-group.stories-UDFOhdWz.js} +2 -2
  56. package/dist/storybook/assets/{input-validation-YadXYe7E.js → input-validation-20MUxBI6.js} +2 -2
  57. package/dist/storybook/assets/{inputs-YvlPtTke.js → inputs-TmWBRWaW.js} +14 -14
  58. package/dist/storybook/assets/{label-RpB4JmHX.js → label-J7MI85wD.js} +1 -1
  59. package/dist/storybook/assets/label.stories-kmvMrgz2.js +11 -0
  60. package/dist/storybook/assets/{layout-forms-2UsPyZyz.js → layout-forms-kkgtzmiO.js} +4 -4
  61. package/dist/storybook/assets/{layout-general-ma7VihYF.js → layout-general-BO1UiJxQ.js} +2 -2
  62. package/dist/storybook/assets/list-heading-5IIpXtaS.js +1 -0
  63. package/dist/storybook/assets/list-heading-dR7AAq04.css +1 -0
  64. package/dist/storybook/assets/list-vXYnYUi0.js +8 -0
  65. package/dist/storybook/assets/list.stories-KCjHPYZx.js +478 -0
  66. package/dist/storybook/assets/{list.stories-data-8eswVWst.js → list.stories-data-p4t83IOz.js} +1 -1
  67. package/dist/storybook/assets/{loader.stories-G8Q_Fm8u.js → loader.stories-NPfeCmtc.js} +2 -2
  68. package/dist/storybook/assets/menu.stories-t0fFav_z.js +82 -0
  69. package/dist/storybook/assets/{message-uMHaTEXV.js → message-p9VAXLNZ.js} +1 -1
  70. package/dist/storybook/assets/{message.stories-BqM_-mrZ.js → message.stories-uPLoUdpD.js} +2 -2
  71. package/dist/storybook/assets/{modal.stories-K4XxeWTp.js → modal.stories-7Z_rzYSc.js} +2 -2
  72. package/dist/storybook/assets/{number-input-d7hXQldd.js → number-input-wURqWy_O.js} +1 -1
  73. package/dist/storybook/assets/{number-input.stories-SOsG2FLJ.js → number-input.stories-V3bsui-x.js} +2 -2
  74. package/dist/storybook/assets/objectWithoutPropertiesLoose-9Q1jwsKS.js +1 -0
  75. package/dist/storybook/assets/option-dropdown.stories-XXhHv7Q-.js +21 -0
  76. package/dist/storybook/assets/{padding-and-spacing-KtiMa5GK.js → padding-and-spacing-ResQ517B.js} +1 -1
  77. package/dist/storybook/assets/page.stories-WaAu4bZx.js +57 -0
  78. package/dist/storybook/assets/{pagination-Eaj_UOBW.js → pagination-WmRtOUjO.js} +1 -1
  79. package/dist/storybook/assets/{pagination.stories-sl2a8BMq.js → pagination.stories-leit5iOS.js} +2 -2
  80. package/dist/storybook/assets/pop-confirm.stories-PknEXhpI.js +9 -0
  81. package/dist/storybook/assets/{popover-uAo1e4-D.js → popover-ZT5lBU-W.js} +1 -1
  82. package/dist/storybook/assets/popover.stories-Jsd7AOQD.js +1 -0
  83. package/dist/storybook/assets/{preview-f1_nby1-.js → preview-5oXwpv5M.js} +3 -3
  84. package/dist/storybook/assets/{preview-lDu82Bod.js → preview-XaSsmro5.js} +2 -2
  85. package/dist/storybook/assets/projects.stories-thRPHYqQ.js +47 -0
  86. package/dist/storybook/assets/{radio-button-QcS9mLYi.js → radio-button-T38JdN-I.js} +1 -1
  87. package/dist/storybook/assets/{radio-button.stories-KCS981-F.js → radio-button.stories-MbtUJQ4_.js} +5 -5
  88. package/dist/storybook/assets/react-router-dom-2JKSc1g5.js +8 -0
  89. package/dist/storybook/assets/{reservoirs.stories-Dg5QFAXV.js → reservoirs.stories-qYaPMbjv.js} +2 -2
  90. package/dist/storybook/assets/{rich-text-input.stories-D55Op5Gf.js → rich-text-input.stories-hYx4gSgs.js} +3 -3
  91. package/dist/storybook/assets/{row.stories-2iigGv-u.js → row.stories-1uI0HLm0.js} +2 -2
  92. package/dist/storybook/assets/{select-Z1HqJ5aU.js → select-kE9fK8N9.js} +1 -1
  93. package/dist/storybook/assets/{select.stories-oUxeDUts.js → select.stories-U32XvwIb.js} +2 -2
  94. package/dist/storybook/assets/side-bar-_tR5JeGc.js +1 -0
  95. package/dist/storybook/assets/side-bar.stories-I7ZQcntL.js +27 -0
  96. package/dist/storybook/assets/{site.stories-OEW6o2C_.js → site.stories-ltRQw7Km.js} +2 -2
  97. package/dist/storybook/assets/{slider-_5NQKbM-.js → slider-XJwLz14m.js} +2 -2
  98. package/dist/storybook/assets/{slider.stories-QyyBB_rz.js → slider.stories-10JT-qwQ.js} +4 -4
  99. package/dist/storybook/assets/spacer.stories-hs33H_N9.js +1 -0
  100. package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-q0TZrkav.js → syntaxhighlighter-NMPM6SWI-CwboJMBs.js} +1 -1
  101. package/dist/storybook/assets/{table-_jWgMFOi.js → table-geCXJ5Oo.js} +1 -1
  102. package/dist/storybook/assets/{table.stories-QupkMmra.js → table.stories-63gTcmnB.js} +2 -2
  103. package/dist/storybook/assets/{table.stories-data-w897tYMJ.js → table.stories-data-ehBuODKA.js} +1 -1
  104. package/dist/storybook/assets/text-link.stories-_A7eKI_2.js +14 -0
  105. package/dist/storybook/assets/{textarea-2SpO5fge.js → textarea-mYEkEnUR.js} +1 -1
  106. package/dist/storybook/assets/{textarea.stories-IgfK-23t.js → textarea.stories-ARS3RM31.js} +1 -1
  107. package/dist/storybook/assets/{title.stories-14d2lIxy.js → title.stories-0uqbMXQe.js} +3 -3
  108. package/dist/storybook/assets/{toaster-eOozfa7U.js → toaster-bqqWcltU.js} +1 -1
  109. package/dist/storybook/assets/{toaster.stories-XhUo3pbR.js → toaster.stories-j_yWcF95.js} +2 -2
  110. package/dist/storybook/assets/{toggle-wk0GbVB8.js → toggle-b0PkHQDl.js} +1 -1
  111. package/dist/storybook/assets/{toggle.stories-ItCMhW4M.js → toggle.stories-zMCWB_3O.js} +2 -2
  112. package/dist/storybook/assets/tooltip.test-case.stories-Vq8nFCVS.js +3 -0
  113. package/dist/storybook/assets/top-bar-K-LdFikH.css +1 -0
  114. package/dist/storybook/assets/top-bar-e2jItFw6.js +1 -0
  115. package/dist/storybook/assets/top-bar.stories-Dz8tdKm4.js +21 -0
  116. package/dist/storybook/assets/top-bar.testcase.stories-2MxbcV7T.js +30 -0
  117. package/dist/storybook/assets/tree-U4LtpVm9.css +1 -0
  118. package/dist/storybook/assets/tree.stories-U6RKMnnO.js +182 -0
  119. package/dist/storybook/assets/unit-input.stories-S31ymsIe.js +273 -0
  120. package/dist/storybook/assets/unit-table.stories-8hLAgPN9.js +103 -0
  121. package/dist/storybook/assets/use-previous-VKMmnaK7.js +1 -0
  122. package/dist/storybook/iframe.html +1 -1
  123. package/dist/storybook/index.json +1 -1
  124. package/dist/storybook/project.json +1 -1
  125. package/dist/storybook/stories.json +1 -1
  126. package/package.json +10 -9
  127. package/dist/storybook/assets/actions-SGexXf58.js +0 -1
  128. package/dist/storybook/assets/actions.stories-dDCC23QK.js +0 -1
  129. package/dist/storybook/assets/afe.stories-1YkAm2l2.js +0 -88
  130. package/dist/storybook/assets/badge.stories-nzXJ1qip.js +0 -1
  131. package/dist/storybook/assets/blowout.stories-ro9WCHli.js +0 -40
  132. package/dist/storybook/assets/button-IoNblLER.js +0 -1
  133. package/dist/storybook/assets/button.stories-vebimSi_.js +0 -71
  134. package/dist/storybook/assets/card.stories-OtRekExg.js +0 -1
  135. package/dist/storybook/assets/color-HUGaUBn2.js +0 -25
  136. package/dist/storybook/assets/empty.stories-KIByp315.js +0 -1
  137. package/dist/storybook/assets/file-input.stories-rkAlSDHE.js +0 -66
  138. package/dist/storybook/assets/footer.stories-FmE2JKok.js +0 -3
  139. package/dist/storybook/assets/form.stories-LRkCBjZR.js +0 -49
  140. package/dist/storybook/assets/formation.stories-ZGzBQKt1.js +0 -74
  141. package/dist/storybook/assets/help-icon.stories-Qz7MKCnQ.js +0 -4
  142. package/dist/storybook/assets/icon.stories-D_XEmSGG.js +0 -6
  143. package/dist/storybook/assets/iframe-yZ0ImE73.js +0 -7
  144. package/dist/storybook/assets/index-IQMsp8Ab.js +0 -14
  145. package/dist/storybook/assets/index.es-JXn3JM7k.js +0 -86
  146. package/dist/storybook/assets/label.stories-HcdQ1bEB.js +0 -11
  147. package/dist/storybook/assets/list-ciYNlkVM.js +0 -8
  148. package/dist/storybook/assets/list-heading-XbqCJOHh.js +0 -1
  149. package/dist/storybook/assets/list-heading-Y8BAUuV6.css +0 -1
  150. package/dist/storybook/assets/list.stories-G1n5uCjl.js +0 -457
  151. package/dist/storybook/assets/menu.stories-GFJs09Wk.js +0 -60
  152. package/dist/storybook/assets/option-dropdown.stories-1Y5JDaBF.js +0 -21
  153. package/dist/storybook/assets/page.stories-B5gzoAi8.js +0 -57
  154. package/dist/storybook/assets/pop-confirm.stories-94l3Xg8w.js +0 -9
  155. package/dist/storybook/assets/popover.stories-JVzzF0Jm.js +0 -1
  156. package/dist/storybook/assets/projects.stories-ojOsn6HU.js +0 -47
  157. package/dist/storybook/assets/side-bar-GJ2tcZYY.js +0 -1
  158. package/dist/storybook/assets/side-bar.stories-Ld0zOToQ.js +0 -1
  159. package/dist/storybook/assets/spacer.stories--ynGgvN4.js +0 -1
  160. package/dist/storybook/assets/text-link.stories-kjfUeFtk.js +0 -1
  161. package/dist/storybook/assets/tooltip.test-case.stories-L2bW8Ijz.js +0 -3
  162. package/dist/storybook/assets/top-bar-0fDAFWyC.js +0 -1
  163. package/dist/storybook/assets/top-bar-cBtxm6yr.css +0 -1
  164. package/dist/storybook/assets/top-bar.stories-YKtteM_h.js +0 -1
  165. package/dist/storybook/assets/top-bar.testcase.stories-Z-6C5D2R.js +0 -30
  166. package/dist/storybook/assets/tree-zmq4MRb6.css +0 -1
  167. package/dist/storybook/assets/tree.stories-5fjCVN1S.js +0 -180
  168. package/dist/storybook/assets/unit-input.stories-ZdrR9JWT.js +0 -273
package/dist/index.js CHANGED
@@ -10,8 +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 } 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 } from "@oliasoft-open-source/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, isObjectLike, has as has$1, isEqual as isEqual$4 } from "lodash";
14
+ import { roundToFixed, 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, isScientificStringNum, roundToPrecision } from "@oliasoft-open-source/units";
15
15
  import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
16
16
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
17
17
  function getDefaultExportFromCjs(x2) {
@@ -4133,8 +4133,10 @@ const Button$1 = ({
4133
4133
  warning: warning2,
4134
4134
  testId,
4135
4135
  tooltip: tooltip2,
4136
- inverted: inverted2 = false
4136
+ inverted: inverted2 = false,
4137
4137
  // *Deprecated*
4138
+ component: Component2 = "button",
4139
+ url
4138
4140
  }) => {
4139
4141
  const disabledContext = useContext(DisabledContext);
4140
4142
  const color2 = (() => {
@@ -4168,7 +4170,7 @@ const Button$1 = ({
4168
4170
  return "";
4169
4171
  })();
4170
4172
  return /* @__PURE__ */ jsx(ButtonTooltipWrapper, { tooltip: tooltip2, children: /* @__PURE__ */ jsxs(
4171
- "button",
4173
+ Component2,
4172
4174
  {
4173
4175
  type: type === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
4174
4176
  className: cx$2(
@@ -4192,6 +4194,7 @@ const Button$1 = ({
4192
4194
  ...title2 ? { title: title2 } : {},
4193
4195
  style: { width: width2 },
4194
4196
  "data-testid": testId,
4197
+ to: url,
4195
4198
  children: [
4196
4199
  icon2 && /* @__PURE__ */ jsx("span", { className: buttonStyles.icon, children: /* @__PURE__ */ jsx(Icon, { icon: icon2 }) }),
4197
4200
  loading && /* @__PURE__ */ jsx("span", { className: buttonStyles.icon, children: /* @__PURE__ */ jsx(
@@ -4302,7 +4305,8 @@ const Option$2 = ({
4302
4305
  title: title2,
4303
4306
  upload,
4304
4307
  onChange,
4305
- testId
4308
+ testId,
4309
+ component: Component2 = "a"
4306
4310
  }) => {
4307
4311
  const handleClick2 = (evt) => {
4308
4312
  evt.stopPropagation();
@@ -4318,9 +4322,10 @@ const Option$2 = ({
4318
4322
  onClick == null ? void 0 : onClick(evt);
4319
4323
  };
4320
4324
  return /* @__PURE__ */ jsxs(
4321
- "a",
4325
+ Component2,
4322
4326
  {
4323
4327
  href: url,
4328
+ to: url,
4324
4329
  className: cx$2(
4325
4330
  styles$L.option,
4326
4331
  disabled2 ? styles$L.disabled : "",
@@ -4406,7 +4411,8 @@ const Section$1 = ({
4406
4411
  title: section2.title,
4407
4412
  upload: section2.upload,
4408
4413
  onChange: section2.onChange,
4409
- testId: section2.testId
4414
+ testId: section2.testId,
4415
+ component: section2.component
4410
4416
  }
4411
4417
  );
4412
4418
  case MenuType.MENU:
@@ -15423,7 +15429,7 @@ var getStyles = function getStyles2(rules2, property) {
15423
15429
  return rule.selector + " { " + value + " }";
15424
15430
  }).join(" ");
15425
15431
  };
15426
- var noPointerEvents = "pointer-events: none;";
15432
+ var noPointerEvents$1 = "pointer-events: none;";
15427
15433
  var getStyles$1 = function(contextId) {
15428
15434
  var getSelector2 = makeGetSelector(contextId);
15429
15435
  var dragHandle$1 = function() {
@@ -15433,7 +15439,7 @@ var getStyles$1 = function(contextId) {
15433
15439
  styles: {
15434
15440
  always: "\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",
15435
15441
  resting: grabCursor,
15436
- dragging: noPointerEvents,
15442
+ dragging: noPointerEvents$1,
15437
15443
  dropAnimating: grabCursor
15438
15444
  }
15439
15445
  };
@@ -18784,44 +18790,45 @@ var InfiniteScroll = (
18784
18790
  return InfiniteScroll2;
18785
18791
  }(Component$1)
18786
18792
  );
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";
18793
+ const inputInTable$8 = "_inputInTable_tn20e_1";
18794
+ const inputHover$8 = "_inputHover_tn20e_13";
18795
+ const inputFocus$8 = "_inputFocus_tn20e_18";
18796
+ const inputError$8 = "_inputError_tn20e_25";
18797
+ const inputWarning$8 = "_inputWarning_tn20e_26";
18798
+ const inputDisabled$8 = "_inputDisabled_tn20e_61";
18799
+ const hideScrollbars$8 = "_hideScrollbars_tn20e_67";
18800
+ const header$1 = "_header_tn20e_77";
18801
+ const headerTitle = "_headerTitle_tn20e_77";
18802
+ const heading$3 = "_heading_tn20e_78";
18803
+ const itemHeader = "_itemHeader_tn20e_78";
18804
+ const narrow = "_narrow_tn20e_81";
18805
+ const stickyHeader = "_stickyHeader_tn20e_85";
18806
+ const title$3 = "_title_tn20e_96";
18807
+ const name = "_name_tn20e_102";
18808
+ const iconTooltipMargin = "_iconTooltipMargin_tn20e_105";
18809
+ const bold = "_bold_tn20e_108";
18810
+ const toggleNarrow = "_toggleNarrow_tn20e_117";
18811
+ const drag$1 = "_drag_tn20e_135";
18812
+ const list$1 = "_list_tn20e_155";
18813
+ const bordered$1 = "_bordered_tn20e_159";
18814
+ const item$4 = "_item_tn20e_78";
18815
+ const action = "_action_tn20e_192";
18816
+ const active$3 = "_active_tn20e_195";
18817
+ const indented = "_indented_tn20e_202";
18818
+ const disabled$5 = "_disabled_tn20e_215";
18819
+ const label$6 = "_label_tn20e_226";
18820
+ const details$2 = "_details_tn20e_237";
18821
+ const metadata = "_metadata_tn20e_238";
18822
+ const itemContent = "_itemContent_tn20e_246";
18823
+ const indentIcon = "_indentIcon_tn20e_253";
18824
+ const expandIcon = "_expandIcon_tn20e_258";
18825
+ const expanded = "_expanded_tn20e_265";
18826
+ const right$4 = "_right_tn20e_268";
18827
+ const actions = "_actions_tn20e_276";
18828
+ const scrollableList = "_scrollableList_tn20e_281";
18829
+ const infiniteScrollContainer = "_infiniteScrollContainer_tn20e_286";
18830
+ const hideScrollbar = "_hideScrollbar_tn20e_67";
18831
+ const noPointerEvents = "_noPointerEvents_tn20e_303";
18825
18832
  const listStyles = {
18826
18833
  inputInTable: inputInTable$8,
18827
18834
  inputHover: inputHover$8,
@@ -18860,7 +18867,8 @@ const listStyles = {
18860
18867
  actions,
18861
18868
  scrollableList,
18862
18869
  infiniteScrollContainer,
18863
- hideScrollbar
18870
+ hideScrollbar,
18871
+ noPointerEvents
18864
18872
  };
18865
18873
  const ToggleNarrow = ({
18866
18874
  toggleNarrow: toggleNarrow2,
@@ -18990,10 +18998,12 @@ const ListRow = forwardRef(
18990
18998
  ({ items, expanding, invokeEditOnRowClick, provided, draggable: draggable2 }, listRowRefs) => {
18991
18999
  const disabledContext = useContext(DisabledContext);
18992
19000
  const listElement = (index2, provided2, item2, indent, hasOnClick, edit2) => {
19001
+ const Component2 = item2.component || "a";
18993
19002
  return /* @__PURE__ */ createElement(
18994
- "a",
19003
+ Component2,
18995
19004
  {
18996
19005
  href: item2.url,
19006
+ to: item2.url,
18997
19007
  ref: provided2 == null ? void 0 : provided2.innerRef,
18998
19008
  ...provided2.draggableProps,
18999
19009
  style: getItemStyle(provided2.draggableProps, item2),
@@ -52730,10 +52740,12 @@ const Link$1 = ({
52730
52740
  }) => {
52731
52741
  return /* @__PURE__ */ jsx("div", { className: styles$d.list, children: items.map((link2, i) => {
52732
52742
  const key2 = `${sectionIndex}_${i}`;
52743
+ const Component2 = link2.component || "a";
52733
52744
  return /* @__PURE__ */ jsx(
52734
- "a",
52745
+ Component2,
52735
52746
  {
52736
52747
  href: link2.value,
52748
+ to: link2.value,
52737
52749
  className: cx$2(
52738
52750
  styles$d.item,
52739
52751
  link2.isActive ? styles$d.active : "",
@@ -52785,7 +52797,6 @@ const SideBar = memo(
52785
52797
  }) => {
52786
52798
  const [isOpen2, setIsOpen] = useState(startOpen);
52787
52799
  const onClick = (evt, value, label2, clickHandler) => {
52788
- evt.preventDefault();
52789
52800
  if (typeof clickHandler === "function") {
52790
52801
  evt.currentTarget.value = value;
52791
52802
  evt.currentTarget.label = label2;
@@ -55714,6 +55725,8 @@ const InputCell = ({
55714
55725
  var _a;
55715
55726
  return (_a = cell2.onChange) == null ? void 0 : _a.call(cell2, ev);
55716
55727
  },
55728
+ onFocus: cell2.onFocus,
55729
+ onBlur: cell2.onBlur,
55717
55730
  onPaste: (ev) => {
55718
55731
  var _a;
55719
55732
  return (_a = cell2.onPaste) == null ? void 0 : _a.call(cell2, ev);
@@ -55755,6 +55768,8 @@ const NumberInput = ({
55755
55768
  },
55756
55769
  onFocus = () => {
55757
55770
  },
55771
+ onBlur = () => {
55772
+ },
55758
55773
  tabIndex = 0,
55759
55774
  testId,
55760
55775
  tooltip: tooltip2 = null,
@@ -55763,10 +55778,14 @@ const NumberInput = ({
55763
55778
  },
55764
55779
  allowEmpty = false,
55765
55780
  isInTable: isInTable2,
55766
- groupOrder
55781
+ groupOrder,
55782
+ enableDisplayRounding = false,
55783
+ roundDisplayValue
55767
55784
  }) => {
55785
+ const inputRef = useRef(null);
55768
55786
  const [displayValue, setDisplayValue] = useState(value);
55769
55787
  const [validationError, setValidationError] = useState(null);
55788
+ const [focus2, setFocus] = useState(false);
55770
55789
  const stringName = getStringName$1(name2);
55771
55790
  const validateInputValue = (value2) => {
55772
55791
  let validation = validateNumber(value2);
@@ -55815,6 +55834,26 @@ const NumberInput = ({
55815
55834
  validationCallback(stringName, firstError);
55816
55835
  }
55817
55836
  };
55837
+ useEffect(() => {
55838
+ if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55839
+ const textInput = inputRef.current;
55840
+ if (textInput) {
55841
+ setTimeout(() => {
55842
+ const { length: length2 } = String(displayValue);
55843
+ textInput.setSelectionRange(length2, length2);
55844
+ }, 0);
55845
+ }
55846
+ }
55847
+ }, [focus2]);
55848
+ const onInputFocus = (evt) => {
55849
+ setFocus(true);
55850
+ onFocus(evt);
55851
+ };
55852
+ const onInputBlur = (evt) => {
55853
+ setFocus(false);
55854
+ onBlur(evt);
55855
+ };
55856
+ const roundedDisplayValue = !focus2 && enableDisplayRounding ? roundDisplayValue ? roundDisplayValue(displayValue) : roundToFixed(displayValue, 2) : displayValue;
55818
55857
  return /* @__PURE__ */ jsx(
55819
55858
  Input$1,
55820
55859
  {
@@ -55823,9 +55862,10 @@ const NumberInput = ({
55823
55862
  testId,
55824
55863
  disabled: disabled2,
55825
55864
  placeholder: placeholder3,
55826
- value: displayValue,
55865
+ value: roundedDisplayValue,
55827
55866
  onChange: onSetValue,
55828
- onFocus,
55867
+ onFocus: onInputFocus,
55868
+ onBlur: onInputBlur,
55829
55869
  error: error2 || validationError,
55830
55870
  warning: warning2,
55831
55871
  right: !left2,
@@ -55834,7 +55874,8 @@ const NumberInput = ({
55834
55874
  isInTable: isInTable2,
55835
55875
  groupOrder,
55836
55876
  tabIndex,
55837
- tooltip: tooltip2
55877
+ tooltip: tooltip2,
55878
+ ref: inputRef
55838
55879
  },
55839
55880
  stringName
55840
55881
  );
@@ -55849,6 +55890,8 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
55849
55890
  var _a;
55850
55891
  return (_a = cell2.onChange) == null ? void 0 : _a.call(cell2, ev);
55851
55892
  },
55893
+ onFocus: cell2.onFocus,
55894
+ onBlur: cell2.onBlur,
55852
55895
  placeholder: cell2.placeholder,
55853
55896
  error: cell2.error,
55854
55897
  warning: cell2.warning,
@@ -55859,7 +55902,9 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
55859
55902
  testId,
55860
55903
  tooltip: cell2.tooltip,
55861
55904
  validationCallback: cell2.validationCallback,
55862
- allowEmpty: cell2.allowEmpty
55905
+ allowEmpty: cell2.allowEmpty,
55906
+ enableDisplayRounding: cell2.enableDisplayRounding,
55907
+ roundDisplayValue: cell2.roundDisplayValue
55863
55908
  }
55864
55909
  );
55865
55910
  };
@@ -56126,6 +56171,7 @@ var CellType = /* @__PURE__ */ ((CellType2) => {
56126
56171
  CellType2["SLIDER"] = "Slider";
56127
56172
  CellType2["CHECKBOX"] = "CheckBox";
56128
56173
  CellType2["ACTIONS"] = "Actions";
56174
+ CellType2["AUTO_UNIT"] = "AutoUnit";
56129
56175
  return CellType2;
56130
56176
  })(CellType || {});
56131
56177
  const Cell = ({
@@ -56728,9 +56774,20 @@ const TextLink = ({
56728
56774
  href = void 0,
56729
56775
  target = void 0,
56730
56776
  testId,
56731
- onClick
56777
+ onClick,
56778
+ component: Component2 = "a"
56732
56779
  }) => {
56733
- return /* @__PURE__ */ jsx("a", { href, target, onClick, "data-testid": testId, children: /* @__PURE__ */ jsx(Text, { link: true, children }) });
56780
+ return /* @__PURE__ */ jsx(
56781
+ Component2,
56782
+ {
56783
+ href,
56784
+ to: href,
56785
+ target,
56786
+ onClick,
56787
+ "data-testid": testId,
56788
+ children: /* @__PURE__ */ jsx(Text, { link: true, children })
56789
+ }
56790
+ );
56734
56791
  };
56735
56792
  const inputInTable = "_inputInTable_66zck_1";
56736
56793
  const inputHover = "_inputHover_66zck_13";
@@ -57996,22 +58053,22 @@ const Toggle = ({
57996
58053
  }
57997
58054
  );
57998
58055
  };
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";
58056
+ const topbar = "_topbar_oyr59_11";
58057
+ const fixed = "_fixed_oyr59_21";
58058
+ const appSwitcher = "_appSwitcher_oyr59_29";
58059
+ const title = "_title_oyr59_75";
58060
+ const logo = "_logo_oyr59_91";
58061
+ const label = "_label_oyr59_94";
58062
+ const brand = "_brand_oyr59_99";
58063
+ const version = "_version_oyr59_104";
58064
+ const left = "_left_oyr59_111";
58065
+ const right = "_right_oyr59_112";
58066
+ const item = "_item_oyr59_126";
58067
+ const link = "_link_oyr59_127";
58068
+ const button = "_button_oyr59_138";
58069
+ const menu = "_menu_oyr59_139";
58070
+ const active = "_active_oyr59_168";
58071
+ const alert = "_alert_oyr59_193";
58015
58072
  const styles$3 = {
58016
58073
  topbar,
58017
58074
  fixed,
@@ -58069,7 +58126,8 @@ const Link = ({
58069
58126
  onClick,
58070
58127
  active: active2,
58071
58128
  disabled: disabled2,
58072
- testId
58129
+ testId,
58130
+ component: Component2 = "a"
58073
58131
  }) => {
58074
58132
  const disabledContext = useContext(DisabledContext);
58075
58133
  const handleClick2 = (event) => {
@@ -58079,10 +58137,11 @@ const Link = ({
58079
58137
  onClick == null ? void 0 : onClick(event);
58080
58138
  };
58081
58139
  return /* @__PURE__ */ jsxs(
58082
- "a",
58140
+ Component2,
58083
58141
  {
58084
58142
  className: cx$2(styles$3.link, active2 ? styles$3.active : ""),
58085
58143
  href: url || "#",
58144
+ to: url,
58086
58145
  onClick: handleClick2,
58087
58146
  "aria-disabled": disabled2 || disabledContext,
58088
58147
  "data-testid": testId,
@@ -58106,7 +58165,8 @@ const Element$1 = ({ element }) => {
58106
58165
  onClick: element.onClick,
58107
58166
  active: element.active,
58108
58167
  disabled: element.disabled,
58109
- testId: element.testId
58168
+ testId: element.testId,
58169
+ component: element.component
58110
58170
  }
58111
58171
  ) });
58112
58172
  case ElementType.BUTTON:
@@ -69925,12 +69985,12 @@ function TreeInner(props, ref2) {
69925
69985
  );
69926
69986
  }
69927
69987
  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";
69988
+ const tree = "_tree_15yn1_1";
69989
+ const toggle = "_toggle_15yn1_4";
69990
+ const dropTarget = "_dropTarget_15yn1_11";
69991
+ const draggingSource = "_draggingSource_15yn1_26";
69992
+ const placeholderContainer = "_placeholderContainer_15yn1_29";
69993
+ const placeholder2 = "_placeholder_15yn1_29";
69934
69994
  const styles$1 = {
69935
69995
  tree,
69936
69996
  toggle,
@@ -69946,14 +70006,46 @@ const TreeItem = ({
69946
70006
  onToggle,
69947
70007
  hasChild,
69948
70008
  draggable: draggable2,
69949
- icons: icons2
70009
+ icons: icons2,
70010
+ onDrop
69950
70011
  }) => {
69951
70012
  const { id: id2, data } = node2;
69952
70013
  const { active: active2, testId, onClick, actions: actions2 = [] } = data;
70014
+ const [isDragOver, setDragOver] = React__default.useState(false);
70015
+ const [dragOverStartTime, setDragOverStartTime] = React__default.useState(0);
69953
70016
  const handleToggle = (e2) => {
69954
70017
  e2.stopPropagation();
69955
70018
  onToggle(id2);
69956
70019
  };
70020
+ const handleDragEnter = (event) => {
70021
+ event.preventDefault();
70022
+ event.stopPropagation();
70023
+ if (!isDragOver) {
70024
+ setDragOver(true);
70025
+ setDragOverStartTime((/* @__PURE__ */ new Date()).getTime());
70026
+ }
70027
+ };
70028
+ const handleDragLeave = (event) => {
70029
+ event.preventDefault();
70030
+ event.stopPropagation();
70031
+ if ((/* @__PURE__ */ new Date()).getTime() - dragOverStartTime > 20) {
70032
+ setDragOver(false);
70033
+ }
70034
+ };
70035
+ const handleDragOver = (event) => {
70036
+ event.preventDefault();
70037
+ event.stopPropagation();
70038
+ if (hasChild && !isOpen2 && (/* @__PURE__ */ new Date()).getTime() - dragOverStartTime > 200) {
70039
+ handleToggle(event);
70040
+ }
70041
+ };
70042
+ const handleDrop = (event) => {
70043
+ event.preventDefault();
70044
+ event.stopPropagation();
70045
+ setDragOver(false);
70046
+ setDragOverStartTime((/* @__PURE__ */ new Date()).getTime());
70047
+ onDrop == null ? void 0 : onDrop(event);
70048
+ };
69957
70049
  return /* @__PURE__ */ jsx(
69958
70050
  "div",
69959
70051
  {
@@ -69961,7 +70053,8 @@ const TreeItem = ({
69961
70053
  listStyles.item,
69962
70054
  listStyles.action,
69963
70055
  active2 ? listStyles.active : "",
69964
- depth > 0 ? listStyles.indented : ""
70056
+ depth > 0 ? listStyles.indented : "",
70057
+ isDragOver ? listStyles.bordered : ""
69965
70058
  ),
69966
70059
  style: {
69967
70060
  marginInlineStart: depth * 24
@@ -69974,10 +70067,17 @@ const TreeItem = ({
69974
70067
  handleToggle(evt);
69975
70068
  }
69976
70069
  },
70070
+ onDrop: (evt) => onDrop ? handleDrop(evt) : {},
70071
+ onDragEnter: (evt) => onDrop ? handleDragEnter(evt) : {},
70072
+ onDragOver: (evt) => onDrop ? handleDragOver(evt) : {},
70073
+ onDragLeave: (evt) => onDrop ? handleDragLeave(evt) : {},
69977
70074
  children: /* @__PURE__ */ jsxs(
69978
70075
  "div",
69979
70076
  {
69980
- className: listStyles.itemHeader,
70077
+ className: cx$2(
70078
+ listStyles.itemHeader,
70079
+ isDragOver ? listStyles.noPointerEvents : ""
70080
+ ),
69981
70081
  children: [
69982
70082
  hasChild && /* @__PURE__ */ jsx("div", { className: styles$1.toggle, children: /* @__PURE__ */ jsx(
69983
70083
  Button$1,
@@ -70080,16 +70180,19 @@ const Tree = ({
70080
70180
  newList = transformTreeToList(workingTree);
70081
70181
  onListReorder(newList);
70082
70182
  };
70083
- const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(({ id: id2, droppable: droppable2, parent, name: name2, ...rest }) => ({
70084
- id: id2,
70085
- text: name2,
70086
- droppable: droppable2,
70087
- parent,
70088
- data: {
70089
- name: name2,
70090
- ...rest
70091
- }
70092
- }));
70183
+ const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(
70184
+ ({ id: id2, droppable: droppable2, parent, name: name2, onDrop, ...rest }) => ({
70185
+ id: id2,
70186
+ text: name2,
70187
+ droppable: droppable2,
70188
+ parent,
70189
+ data: {
70190
+ name: name2,
70191
+ onDrop,
70192
+ ...rest
70193
+ }
70194
+ })
70195
+ );
70093
70196
  return /* @__PURE__ */ jsxs("div", { "data-testid": testId, children: [
70094
70197
  list2.name && !list2.noHeader && /* @__PURE__ */ jsx(ListHeading, { name: list2.name, actions: list2.actions }),
70095
70198
  /* @__PURE__ */ jsx("div", { className: listStyles.list, children: /* @__PURE__ */ jsx(
@@ -70113,6 +70216,7 @@ const Tree = ({
70113
70216
  },
70114
70217
  rootId: 0,
70115
70218
  render: (node2, { depth, isOpen: isOpen2, onToggle, hasChild }) => {
70219
+ var _a2;
70116
70220
  return /* @__PURE__ */ jsx(
70117
70221
  TreeItem,
70118
70222
  {
@@ -70125,7 +70229,8 @@ const Tree = ({
70125
70229
  onToggle();
70126
70230
  },
70127
70231
  draggable: draggable2,
70128
- icons: icons2
70232
+ icons: icons2,
70233
+ onDrop: (_a2 = node2.data) == null ? void 0 : _a2.onDrop
70129
70234
  }
70130
70235
  );
70131
70236
  },
@@ -70595,6 +70700,150 @@ const UnitInput = ({
70595
70700
  }
70596
70701
  );
70597
70702
  };
70703
+ const normalizeUnits = (unitConfig) => unitConfig.reduce(
70704
+ ({ preferredUnits, storageUnits }, { unitKey, preferredUnit, storageUnit }) => {
70705
+ preferredUnits[unitKey] = preferredUnit;
70706
+ storageUnits[unitKey] = storageUnit;
70707
+ return { preferredUnits, storageUnits };
70708
+ },
70709
+ { preferredUnits: {}, storageUnits: {} }
70710
+ );
70711
+ const convertVisibleRows = ({
70712
+ headers,
70713
+ rows,
70714
+ selectedUnits,
70715
+ storageUnits,
70716
+ onChangeUnit,
70717
+ convertBackToStorageUnit,
70718
+ enableCosmeticRounding,
70719
+ enableDisplayRounding,
70720
+ roundDisplayValue
70721
+ }) => {
70722
+ const convertedHeaders = headers ? headers.map((headerRow) => ({
70723
+ ...headerRow,
70724
+ cells: headerRow.cells.map((headerCell) => {
70725
+ if (headerCell.type === CellType.AUTO_UNIT) {
70726
+ const { unitKey } = headerCell;
70727
+ return {
70728
+ value: selectedUnits[unitKey],
70729
+ type: CellType.SELECT,
70730
+ options: getUnitsForQuantity(unitKey),
70731
+ native: true,
70732
+ onChange: (evt) => onChangeUnit({ unitKey, value: evt.target.value })
70733
+ };
70734
+ }
70735
+ return headerCell;
70736
+ })
70737
+ })) : [];
70738
+ const convertedRows = rows ? rows.map((row2, rowIndex) => ({
70739
+ ...row2,
70740
+ cells: row2.cells.map((cell2, cellIndex) => {
70741
+ 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")) {
70742
+ const { formatDisplayValue, unitKey, value } = cell2;
70743
+ const selectedUnit = selectedUnits[unitKey];
70744
+ const storageUnit = storageUnits[unitKey];
70745
+ const unitChanged = selectedUnit !== storageUnit;
70746
+ const convertedValue = unitChanged ? convertAndGetValue(value, selectedUnit, storageUnit) : cell2.value;
70747
+ const isScientific = isScientificStringNum(value);
70748
+ const displayValue = enableCosmeticRounding && (unitChanged || !isScientific) ? (
70749
+ /*
70750
+ Optionally do Excel-style "cosmetic rounding" of display values (only if enableCosmeticRounding prop on)
70751
+ This means rounding to slightly less precision than the underlying floating-point number type, to
70752
+ resolve floating-point "rounding noise" associated with storing values in one unit but converting
70753
+ and displaying them in another unit. This solution was evaluated by Tools Team in relation to
70754
+ tickets OW-10614 and OW-15745.
70755
+ */
70756
+ roundToPrecision(convertedValue, 14)
70757
+ ) : convertedValue;
70758
+ const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(displayValue) : displayValue;
70759
+ return {
70760
+ ...cell2,
70761
+ value: formattedDisplayValue,
70762
+ enableCosmeticRounding,
70763
+ enableDisplayRounding,
70764
+ roundDisplayValue,
70765
+ onChange: (evt) => {
70766
+ const { value: value2 } = evt.target;
70767
+ const storageUnit2 = storageUnits[unitKey];
70768
+ const selectedUnit2 = selectedUnits[unitKey];
70769
+ const unitChanged2 = selectedUnit2 !== storageUnit2;
70770
+ const nextValueConverted = unitChanged2 ? convertAndGetValue(value2, storageUnit2, selectedUnit2) : value2;
70771
+ const nextUnit = convertBackToStorageUnit ? storageUnit2 : selectedUnit2;
70772
+ if ("onChange" in cell2) {
70773
+ const { onChange } = cell2;
70774
+ const event = {
70775
+ ...evt,
70776
+ target: {
70777
+ ...evt.target,
70778
+ value: String(nextValueConverted),
70779
+ rowIndex,
70780
+ cellIndex,
70781
+ unit: nextUnit
70782
+ }
70783
+ };
70784
+ onChange(event);
70785
+ }
70786
+ }
70787
+ };
70788
+ }
70789
+ return cell2;
70790
+ })
70791
+ })) : [];
70792
+ return { convertedHeaders, convertedRows };
70793
+ };
70794
+ const UnitTable = ({
70795
+ table: table2,
70796
+ unitConfig,
70797
+ convertBackToStorageUnit = true,
70798
+ enableCosmeticRounding = true,
70799
+ enableDisplayRounding = true,
70800
+ roundDisplayValue
70801
+ }) => {
70802
+ const { rows, headers, ...otherProps } = table2;
70803
+ const { storageUnits, preferredUnits } = normalizeUnits(unitConfig);
70804
+ const previousPreferredUnits = usePrevious(preferredUnits);
70805
+ const [selectedUnits, setSelectedUnits] = useState(preferredUnits);
70806
+ const onChangeUnit = ({
70807
+ unitKey,
70808
+ value
70809
+ }) => setSelectedUnits({
70810
+ ...selectedUnits,
70811
+ [unitKey]: value
70812
+ });
70813
+ const convertViewData = (selectedUnits2) => convertVisibleRows({
70814
+ headers,
70815
+ rows,
70816
+ selectedUnits: selectedUnits2,
70817
+ storageUnits,
70818
+ onChangeUnit,
70819
+ convertBackToStorageUnit,
70820
+ enableCosmeticRounding,
70821
+ enableDisplayRounding,
70822
+ roundDisplayValue
70823
+ });
70824
+ const convertedViewData = convertViewData(selectedUnits);
70825
+ const [viewData, setViewData] = useState(convertedViewData);
70826
+ useEffect(() => {
70827
+ const templateChanged = !isEqual$4(preferredUnits, previousPreferredUnits);
70828
+ if (templateChanged) {
70829
+ setSelectedUnits(preferredUnits);
70830
+ setViewData(convertViewData(preferredUnits));
70831
+ }
70832
+ }, [unitConfig]);
70833
+ useEffect(() => {
70834
+ setViewData(convertViewData(selectedUnits));
70835
+ }, [table2, selectedUnits]);
70836
+ return /* @__PURE__ */ jsx(
70837
+ Table,
70838
+ {
70839
+ table: {
70840
+ ...otherProps,
70841
+ headers: viewData.convertedHeaders,
70842
+ rows: viewData.convertedRows
70843
+ }
70844
+ }
70845
+ );
70846
+ };
70598
70847
  export {
70599
70848
  Accordion,
70600
70849
  AccordionWithDefaultToggle,
@@ -70674,6 +70923,7 @@ export {
70674
70923
  Tree,
70675
70924
  TriggerType,
70676
70925
  UnitInput,
70926
+ UnitTable,
70677
70927
  dismissToast,
70678
70928
  readFile,
70679
70929
  toast,