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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/index.js +18 -13
  2. package/dist/index.js.map +1 -1
  3. package/dist/storybook/assets/{Color-KGDBMAHA-BnHaqcsT.js → Color-KGDBMAHA-Bn4yyV9u.js} +1 -1
  4. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-DcoD1y-5.js → DocsRenderer-PKQXORMH-BUBqlKwY.js} +1 -1
  5. package/dist/storybook/assets/{accordion.stories-D0wb2n-9.js → accordion.stories-kLk1OtZZ.js} +2 -2
  6. package/dist/storybook/assets/{afe.stories-DM18uTAa.js → afe.stories-DFQsvqIV.js} +2 -2
  7. package/dist/storybook/assets/{buttons-and-links-jPZ2UUsp.js → buttons-and-links-a_IVrxwj.js} +1 -1
  8. package/dist/storybook/assets/{casing-loads.stories-Dga1QkGC.js → casing-loads.stories-B2lND_PU.js} +2 -2
  9. package/dist/storybook/assets/{cell.stories-DfyQwzEH.js → cell.stories-BVDrv2SU.js} +2 -2
  10. package/dist/storybook/assets/{chunk-HLWAVYOI-D2AwGCE9.js → chunk-HLWAVYOI-kpZZkSeH.js} +1 -1
  11. package/dist/storybook/assets/{color-CLf9xt55.js → color-Cbf9UrQO.js} +1 -1
  12. package/dist/storybook/assets/footer.stories-BVXSVjq1.js +3 -0
  13. package/dist/storybook/assets/form.stories-BrUnmw7R.js +49 -0
  14. package/dist/storybook/assets/{formation.stories-CZGQhWyA.js → formation.stories-DmecxRaM.js} +2 -2
  15. package/dist/storybook/assets/iframe-DO2I_nJe.js +2 -0
  16. package/dist/storybook/assets/{index-Sr04i8ct.js → index-CP-qN_yN.js} +88 -88
  17. package/dist/storybook/assets/{index-BQ_6rM6u.js → index-Nykkb-Z-.js} +1 -1
  18. package/dist/storybook/assets/{input-group.stories-EhmORqH9.js → input-group.stories-CElwRt3p.js} +3 -3
  19. package/dist/storybook/assets/{input-validation-Tr-aD1VJ.js → input-validation-51gQ2ORg.js} +2 -2
  20. package/dist/storybook/assets/{inputs-BGIgggtv.js → inputs-CPKM4uZ6.js} +1 -1
  21. package/dist/storybook/assets/{layout-forms-n-mRkolR.js → layout-forms-C9pc1r5D.js} +5 -5
  22. package/dist/storybook/assets/{layout-general-CNsKoPG6.js → layout-general-Dks_ONKw.js} +1 -1
  23. package/dist/storybook/assets/{modal.stories-C6Bh0Oda.js → modal.stories-LhoWfDE6.js} +2 -2
  24. package/dist/storybook/assets/number-input-DBZIl9dz.js +16 -0
  25. package/dist/storybook/assets/number-input.stories-CqTYNX8G.js +166 -0
  26. package/dist/storybook/assets/{padding-and-spacing-B10oZ-Ww.js → padding-and-spacing-Bki_uuMD.js} +1 -1
  27. package/dist/storybook/assets/{pagination-DWc8zp3k.js → pagination-CLt-kUlx.js} +1 -1
  28. package/dist/storybook/assets/{pagination.stories-B5cOvzik.js → pagination.stories-CTRM0Xou.js} +2 -2
  29. package/dist/storybook/assets/popover.stories-CGm0M5fv.js +10 -0
  30. package/dist/storybook/assets/{preview-Cym3ID9p.js → preview-DGoeP-Zy.js} +2 -2
  31. package/dist/storybook/assets/{preview-pQMX-q5x.js → preview-yquX1adV.js} +1 -1
  32. package/dist/storybook/assets/{projects.stories-Co_WnKSx.js → projects.stories-BQswWVCx.js} +2 -2
  33. package/dist/storybook/assets/{radio-button-C4ljBRED.js → radio-button-DmDuw4DA.js} +1 -1
  34. package/dist/storybook/assets/{radio-button.stories-BzyW2CtK.js → radio-button.stories-5gvV0LD0.js} +2 -2
  35. package/dist/storybook/assets/{reservoirs.stories-UW_8sofe.js → reservoirs.stories-B12tIrmZ.js} +2 -2
  36. package/dist/storybook/assets/{rich-text-input.stories-0pm7-gTq.js → rich-text-input.stories-hAHCnDHk.js} +3 -3
  37. package/dist/storybook/assets/{row.stories-B8OWE9yd.js → row.stories-BO2s7oph.js} +2 -2
  38. package/dist/storybook/assets/select-DnRuRG_N.js +61 -0
  39. package/dist/storybook/assets/select.input-D0UkAPd9.js +1 -0
  40. package/dist/storybook/assets/{select.stories-B0KIHiMX.js → select.stories-B9w9ONzj.js} +2 -2
  41. package/dist/storybook/assets/{site.stories-ZGohyW6Z.js → site.stories-umpPYjkq.js} +2 -2
  42. package/dist/storybook/assets/{table-qmf29AIJ.js → table-CB6btQu9.js} +1 -1
  43. package/dist/storybook/assets/{table.stories-DzHGqXth.js → table.stories-CvHvaYMC.js} +2 -2
  44. package/dist/storybook/assets/{tabs-BoToLVEP.js → tabs-C3NG6m9W.js} +1 -1
  45. package/dist/storybook/assets/tabs.stories-dsXjRHJy.js +30 -0
  46. package/dist/storybook/assets/{title.stories-B8l1sfdo.js → title.stories-DYXG2_x-.js} +3 -3
  47. package/dist/storybook/assets/unit-input.stories-DRP-nDdh.js +380 -0
  48. package/dist/storybook/assets/unit-table.stories-DiER-CMn.js +152 -0
  49. package/dist/storybook/iframe.html +1 -1
  50. package/dist/storybook/index.json +1 -1
  51. package/dist/storybook/project.json +1 -1
  52. package/package.json +1 -1
  53. package/dist/404.html +0 -1
  54. package/dist/storybook/assets/enum-Bnn40S8Q.js +0 -1
  55. package/dist/storybook/assets/footer.stories-DYBxUtZh.js +0 -3
  56. package/dist/storybook/assets/form.stories-BLcmnfy8.js +0 -49
  57. package/dist/storybook/assets/helpers-JJxzGegQ.js +0 -1
  58. package/dist/storybook/assets/iframe-BnDar59m.js +0 -2
  59. package/dist/storybook/assets/number-input-DZ9ERbK_.js +0 -16
  60. package/dist/storybook/assets/number-input.stories-CmVUHT2d.js +0 -124
  61. package/dist/storybook/assets/popover.stories-p9_-pH_Q.js +0 -10
  62. package/dist/storybook/assets/select-03uRbc4I.js +0 -61
  63. package/dist/storybook/assets/select.input-CJed_LLR.js +0 -1
  64. package/dist/storybook/assets/tabs.stories-B52iEaHf.js +0 -30
  65. package/dist/storybook/assets/unit-input.stories-BnLB_Avl.js +0 -316
  66. package/dist/storybook/assets/unit-table.stories-DquyyMbD.js +0 -152
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import * as PropTypes from "prop-types";
16
16
  import PropTypes__default from "prop-types";
17
17
  import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
18
18
  import { noop as noop$3, 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";
19
- import { isScientificStringNum, roundToPrecision, roundToFixed, toString as toString$1, validateNumber, cleanNumStr, stripLeadingZeros, 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";
19
+ import { isScientificStringNum, roundToPrecision, roundToFixed, toString as toString$1, validateNumber, stripLeadingZeros, 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";
20
20
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
21
21
  function getDefaultExportFromCjs(x2) {
22
22
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -55735,7 +55735,7 @@ const NumberInput = ({
55735
55735
  allowEmpty = false,
55736
55736
  isInTable: isInTable2,
55737
55737
  groupOrder,
55738
- enableCosmeticRounding = false,
55738
+ enableCosmeticRounding = true,
55739
55739
  enableDisplayRounding = false,
55740
55740
  roundDisplayValue,
55741
55741
  disableInternalErrorValidationMessages = false
@@ -55743,6 +55743,7 @@ const NumberInput = ({
55743
55743
  const inputRef = useRef(null);
55744
55744
  const [displayValue, setDisplayValue] = useState(safeToString(value));
55745
55745
  const [focus2, setFocus] = useState(false);
55746
+ const [pristine, setPristine] = useState(true);
55746
55747
  const stringName = getStringName$1(name2);
55747
55748
  const validateInputValue = (value2) => {
55748
55749
  const validation = validateNumber(value2);
@@ -55756,6 +55757,7 @@ const NumberInput = ({
55756
55757
  const firstError = errors2 && errors2.length && !disableInternalErrorValidationMessages ? errors2[0] : null;
55757
55758
  useEffect(() => {
55758
55759
  setDisplayValue(safeToString(value));
55760
+ setPristine(true);
55759
55761
  }, [value, enableCosmeticRounding, enableDisplayRounding]);
55760
55762
  useEffect(() => {
55761
55763
  if (!focus2 && !valid) {
@@ -55765,24 +55767,27 @@ const NumberInput = ({
55765
55767
  }
55766
55768
  }, [focus2, valid, error2]);
55767
55769
  const onChangeValue = (evt) => {
55768
- var _a2, _b;
55769
- const value2 = evt instanceof KeyboardEvent ? displayValue : (_a2 = evt == null ? void 0 : evt.target) == null ? void 0 : _a2.value;
55770
- const inputValue = cleanNumStr(
55771
- value2.replaceAll(" ", "").replaceAll("|", "")
55772
- );
55773
- setDisplayValue(inputValue);
55774
- if ((_b = validateInputValue(inputValue)) == null ? void 0 : _b.valid) {
55770
+ if (valid && !pristine) {
55775
55771
  const event = {
55776
55772
  ...evt,
55777
55773
  target: {
55778
55774
  ...evt.target,
55779
- value: stripLeadingZeros(safeToString(inputValue)),
55775
+ value: stripLeadingZeros(safeToString(displayValue)),
55780
55776
  name: stringName
55781
55777
  }
55782
55778
  };
55783
55779
  onChange(event);
55784
55780
  }
55785
55781
  };
55782
+ const onSetValue = (evt) => {
55783
+ const input2 = evt.target;
55784
+ const { value: value2 } = input2;
55785
+ const inputValue = cleanNumStr(
55786
+ value2.replaceAll(" ", "").replaceAll("|", "")
55787
+ );
55788
+ setDisplayValue(inputValue);
55789
+ setPristine(false);
55790
+ };
55786
55791
  useEffect(() => {
55787
55792
  if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55788
55793
  const textInput = inputRef.current;
@@ -55825,10 +55830,10 @@ const NumberInput = ({
55825
55830
  disabled: disabled2,
55826
55831
  placeholder: placeholder3,
55827
55832
  value: valueWithCosmeticRounding,
55828
- onChange: onChangeValue,
55833
+ onChange: onSetValue,
55829
55834
  onFocus: onInputFocus,
55830
55835
  onBlur: onInputBlur,
55831
- error: firstError || error2,
55836
+ error: !focus2 && (firstError || error2),
55832
55837
  warning: warning2,
55833
55838
  right: !left2,
55834
55839
  small: small2,
@@ -70299,7 +70304,7 @@ const UnitInput = ({
70299
70304
  allowEmpty = false,
70300
70305
  autoValue,
70301
70306
  convertBackToStorageUnit = false,
70302
- enableCosmeticRounding = false,
70307
+ enableCosmeticRounding = true,
70303
70308
  enableDisplayRounding = false
70304
70309
  }) => {
70305
70310
  const context2 = useUnitContext();