@oliasoft-open-source/react-ui-library 4.2.0-beta-3 → 4.2.1-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 (136) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +35 -17
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/Color-6VNJS4EI-38f93e87.js +1 -0
  5. package/dist/storybook/assets/DocsRenderer-NNNQARDV-850c5573.js +1 -0
  6. package/dist/storybook/assets/WithTooltip-4HIR6TLV-c574e731.js +1 -0
  7. package/dist/storybook/assets/{accordion-168fa7c5.js → accordion-1b587708.js} +1 -1
  8. package/dist/storybook/assets/{accordion.stories-0f8af16e.js → accordion.stories-41aed20e.js} +2 -2
  9. package/dist/storybook/assets/{actions-2d4e1c8e.js → actions-83a2a04e.js} +1 -1
  10. package/dist/storybook/assets/{actions.stories-81a7cb7a.js → actions.stories-a38cd26e.js} +1 -1
  11. package/dist/storybook/assets/{afe.stories-afb9be07.js → afe.stories-a4fbd6ce.js} +2 -2
  12. package/dist/storybook/assets/{badge.stories-5ce7957f.js → badge.stories-1cbf35f9.js} +1 -1
  13. package/dist/storybook/assets/{blowout.stories-ee7f932b.js → blowout.stories-3d16e5ec.js} +1 -1
  14. package/dist/storybook/assets/{button-74c97e4a.js → button-050c998a.js} +1 -1
  15. package/dist/storybook/assets/{button-group-fa895d0c.js → button-group-0176fca3.js} +1 -1
  16. package/dist/storybook/assets/{button-group.stories-22f072b7.js → button-group.stories-7659a587.js} +1 -1
  17. package/dist/storybook/assets/{button.stories-9b954335.js → button.stories-5f73ddef.js} +1 -1
  18. package/dist/storybook/assets/buttons-and-links-dab2a936.js +14 -0
  19. package/dist/storybook/assets/{card.stories-537a1772.js → card.stories-0437a4e2.js} +1 -1
  20. package/dist/storybook/assets/{casing-loads.stories-cfbab702.js → casing-loads.stories-d5882170.js} +2 -2
  21. package/dist/storybook/assets/{cell.stories-524a7418.js → cell.stories-0ae4bf08.js} +2 -2
  22. package/dist/storybook/assets/{check-box-e21258d5.js → check-box-b38490e5.js} +1 -1
  23. package/dist/storybook/assets/{check-box.stories-5f7d06e0.js → check-box.stories-9bf1c260.js} +1 -1
  24. package/dist/storybook/assets/{chunk-HLWAVYOI-1b1e8383.js → chunk-HLWAVYOI-48e544a6.js} +1 -1
  25. package/dist/storybook/assets/color-c848f869.js +25 -0
  26. package/dist/storybook/assets/{column.stories-ae7588c5.js → column.stories-d5ca2c42.js} +1 -1
  27. package/dist/storybook/assets/{dialog-cd58dd09.js → dialog-c036ff34.js} +1 -1
  28. package/dist/storybook/assets/{drawer-7f450988.js → drawer-308b0a03.js} +1 -1
  29. package/dist/storybook/assets/{drawer.stories-39625e91.js → drawer.stories-d76c0577.js} +2 -2
  30. package/dist/storybook/assets/{empty.stories-e0e3ac78.js → empty.stories-30fdd793.js} +1 -1
  31. package/dist/storybook/assets/extends-98964cd2.js +1 -0
  32. package/dist/storybook/assets/{field-a094cd72.js → field-248df38c.js} +1 -1
  33. package/dist/storybook/assets/{field.stories-f1318053.js → field.stories-60d1a82f.js} +1 -1
  34. package/dist/storybook/assets/{file-input.stories-1c6ce0ea.js → file-input.stories-6878a9b8.js} +1 -1
  35. package/dist/storybook/assets/{flex.stories-09e9c602.js → flex.stories-6a278b40.js} +1 -1
  36. package/dist/storybook/assets/footer.stories-50a2e3db.js +3 -0
  37. package/dist/storybook/assets/form.stories-fb337772.js +49 -0
  38. package/dist/storybook/assets/formation.stories-3c9cd637.js +74 -0
  39. package/dist/storybook/assets/{formatter-SWP5E3XI-d3a9e021.js → formatter-SWP5E3XI-3022f287.js} +2 -2
  40. package/dist/storybook/assets/{heading-d29eb744.js → heading-39e599c8.js} +1 -1
  41. package/dist/storybook/assets/{heading.stories-9689bddc.js → heading.stories-6ff7f5ed.js} +1 -1
  42. package/dist/storybook/assets/{help-icon-d4189b1b.js → help-icon-c0abd380.js} +1 -1
  43. package/dist/storybook/assets/{help-icon.stories-15d1620d.js → help-icon.stories-a30b7058.js} +1 -1
  44. package/dist/storybook/assets/icon-8acf9925.js +8 -0
  45. package/dist/storybook/assets/{icon.stories-8dae69e1.js → icon.stories-466d158f.js} +1 -1
  46. package/dist/storybook/assets/iframe-c049b5de.js +1 -0
  47. package/dist/storybook/assets/{index-5d28dded.js → index-facfe879.js} +4 -4
  48. package/dist/storybook/assets/{index.es-85cc7dfc.js → index.es-37e2ce0d.js} +4 -4
  49. package/dist/storybook/assets/inheritsLoose-c82a83d4.js +1 -0
  50. package/dist/storybook/assets/{input-d68625a5.js → input-05f21b51.js} +1 -1
  51. package/dist/storybook/assets/{input-group.stories-a2a3400e.js → input-group.stories-602e1e93.js} +2 -2
  52. package/dist/storybook/assets/{input-validation-141270c5.js → input-validation-36225c65.js} +2 -2
  53. package/dist/storybook/assets/{input.stories-164d93ab.js → input.stories-bf58ba7c.js} +1 -1
  54. package/dist/storybook/assets/{inputs-851ed326.js → inputs-76e61ee6.js} +2 -2
  55. package/dist/storybook/assets/{label-13d490a3.js → label-e6d15b59.js} +1 -1
  56. package/dist/storybook/assets/{label.stories-427ba162.js → label.stories-1c98204a.js} +1 -1
  57. package/dist/storybook/assets/layout-forms-e5b070bb.js +16 -0
  58. package/dist/storybook/assets/{layout-general-2e5a4012.js → layout-general-86c12240.js} +2 -2
  59. package/dist/storybook/assets/{list-0dc3df85.js → list-bc0d9ad9.js} +1 -1
  60. package/dist/storybook/assets/{list-heading-88cc8a9b.js → list-heading-2215213f.js} +1 -1
  61. package/dist/storybook/assets/{list.stories-5715452e.js → list.stories-c8b4f325.js} +2 -2
  62. package/dist/storybook/assets/{list.stories-data-94f7c623.js → list.stories-data-ba40864f.js} +1 -1
  63. package/dist/storybook/assets/{loader.stories-6107832a.js → loader.stories-4e8e8df7.js} +1 -1
  64. package/dist/storybook/assets/{menu.stories-927adf3d.js → menu.stories-8d724757.js} +1 -1
  65. package/dist/storybook/assets/{message-7e627e60.js → message-0b5ae3c5.js} +1 -1
  66. package/dist/storybook/assets/{message.stories-f41a0c22.js → message.stories-9b9c40c4.js} +1 -1
  67. package/dist/storybook/assets/{modal.stories-0e068cc1.js → modal.stories-1b13be75.js} +2 -2
  68. package/dist/storybook/assets/{number-input-7d49b0b3.js → number-input-cfbd9eb7.js} +1 -1
  69. package/dist/storybook/assets/{number-input.stories-02528124.js → number-input.stories-8137782e.js} +2 -2
  70. package/dist/storybook/assets/{option-dropdown.stories-5030bdb8.js → option-dropdown.stories-4c391727.js} +1 -1
  71. package/dist/storybook/assets/{padding-and-spacing-d5b7037c.js → padding-and-spacing-27184e3b.js} +2 -2
  72. package/dist/storybook/assets/{page.stories-7cb68fed.js → page.stories-8d0476d7.js} +1 -1
  73. package/dist/storybook/assets/{pagination-8aade846.js → pagination-443065a8.js} +1 -1
  74. package/dist/storybook/assets/{pagination.stories-423b4938.js → pagination.stories-985230f7.js} +2 -2
  75. package/dist/storybook/assets/{pop-confirm.stories-81b30901.js → pop-confirm.stories-3016f322.js} +1 -1
  76. package/dist/storybook/assets/{popover-06e375a5.js → popover-c1234faa.js} +1 -1
  77. package/dist/storybook/assets/popover.stories-7542a367.js +1 -0
  78. package/dist/storybook/assets/preview-2ce67243.js +1 -0
  79. package/dist/storybook/assets/{preview-3a1dcfd9.js → preview-b8e17d34.js} +3 -3
  80. package/dist/storybook/assets/projects.stories-47d63f05.js +47 -0
  81. package/dist/storybook/assets/{radio-button-135a9615.js → radio-button-d69b72e4.js} +1 -1
  82. package/dist/storybook/assets/{radio-button.stories-0e8377ea.js → radio-button.stories-6ff0dc9b.js} +1 -1
  83. package/dist/storybook/assets/{reservoirs.stories-6b14a37f.js → reservoirs.stories-537002ca.js} +2 -2
  84. package/dist/storybook/assets/{rich-text-input.stories-661f34f1.js → rich-text-input.stories-383819b4.js} +3 -3
  85. package/dist/storybook/assets/{row.stories-d5b6b4a6.js → row.stories-c12a3e52.js} +2 -2
  86. package/dist/storybook/assets/select-d4593fc0.js +1 -0
  87. package/dist/storybook/assets/{select.stories-60f055e6.js → select.stories-6651d3f2.js} +2 -2
  88. package/dist/storybook/assets/{side-bar-88e8cf41.js → side-bar-10cceacd.js} +1 -1
  89. package/dist/storybook/assets/{side-bar.stories-2c06f8a6.js → side-bar.stories-02211e0d.js} +1 -1
  90. package/dist/storybook/assets/{site.stories-dee8ce1c.js → site.stories-9486039d.js} +2 -2
  91. package/dist/storybook/assets/slider-5d5442fe.js +7 -0
  92. package/dist/storybook/assets/{slider.stories-79ab0e97.js → slider.stories-a55df653.js} +2 -2
  93. package/dist/storybook/assets/{spacer.stories-38071af8.js → spacer.stories-a2798d47.js} +1 -1
  94. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI-abcfc30f.js +1 -0
  95. package/dist/storybook/assets/{table-da6f6045.js → table-134da40b.js} +1 -1
  96. package/dist/storybook/assets/{table.stories-67a3023a.js → table.stories-8dd2a568.js} +2 -2
  97. package/dist/storybook/assets/{table.stories-data-8a836b92.js → table.stories-data-ddbcf8c3.js} +1 -1
  98. package/dist/storybook/assets/{textarea-d48efea2.js → textarea-5ebdd171.js} +1 -1
  99. package/dist/storybook/assets/{textarea.stories-89c8afd7.js → textarea.stories-02879684.js} +1 -1
  100. package/dist/storybook/assets/{title.stories-5b4a226c.js → title.stories-2ba6aa87.js} +2 -2
  101. package/dist/storybook/assets/{toaster-541ce85b.js → toaster-f096ba56.js} +1 -1
  102. package/dist/storybook/assets/{toaster.stories-5e4d95b1.js → toaster.stories-66162195.js} +1 -1
  103. package/dist/storybook/assets/{toggle-bb34b2a2.js → toggle-6f4d5797.js} +1 -1
  104. package/dist/storybook/assets/{toggle.stories-b771ed81.js → toggle.stories-a289f544.js} +1 -1
  105. package/dist/storybook/assets/{tooltip-23e84186.js → tooltip-856042a7.js} +1 -1
  106. package/dist/storybook/assets/{tooltip.stories-e8ba5fff.js → tooltip.stories-666868d0.js} +1 -1
  107. package/dist/storybook/assets/{tooltip.test-case.stories-9817078b.js → tooltip.test-case.stories-4c1ea273.js} +1 -1
  108. package/dist/storybook/assets/{top-bar-a84b9365.js → top-bar-2c70083e.js} +1 -1
  109. package/dist/storybook/assets/{top-bar.stories-e93330f0.js → top-bar.stories-bbfb7220.js} +1 -1
  110. package/dist/storybook/assets/{top-bar.testcase.stories-3a824a14.js → top-bar.testcase.stories-1d4c6e3a.js} +1 -1
  111. package/dist/storybook/assets/{tree.stories-590bdd69.js → tree.stories-729aebd7.js} +1 -1
  112. package/dist/storybook/assets/unit-input.stories-035fa696.js +265 -0
  113. package/dist/storybook/iframe.html +1 -1
  114. package/dist/storybook/index.json +1 -1
  115. package/dist/storybook/project.json +1 -1
  116. package/dist/storybook/stories.json +1 -1
  117. package/package.json +1 -1
  118. package/dist/storybook/assets/Color-6VNJS4EI-4a5d7280.js +0 -1
  119. package/dist/storybook/assets/DocsRenderer-NNNQARDV-72503a2d.js +0 -1
  120. package/dist/storybook/assets/WithTooltip-4HIR6TLV-23437932.js +0 -1
  121. package/dist/storybook/assets/buttons-and-links-c7506f52.js +0 -14
  122. package/dist/storybook/assets/color-e373f623.js +0 -25
  123. package/dist/storybook/assets/footer.stories-57f07ea2.js +0 -3
  124. package/dist/storybook/assets/form.stories-45c0cd59.js +0 -49
  125. package/dist/storybook/assets/formation.stories-5eeaa826.js +0 -74
  126. package/dist/storybook/assets/icon-e9cbb4d7.js +0 -8
  127. package/dist/storybook/assets/iframe-210f2f48.js +0 -1
  128. package/dist/storybook/assets/inheritsLoose-d4851ab8.js +0 -1
  129. package/dist/storybook/assets/layout-forms-8fb9eb93.js +0 -16
  130. package/dist/storybook/assets/popover.stories-f651a81c.js +0 -1
  131. package/dist/storybook/assets/preview-78133dba.js +0 -1
  132. package/dist/storybook/assets/projects.stories-3884a80c.js +0 -47
  133. package/dist/storybook/assets/select-205cd538.js +0 -1
  134. package/dist/storybook/assets/slider-160e2152.js +0 -7
  135. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI-35b98f86.js +0 -1
  136. package/dist/storybook/assets/unit-input.stories-50ac8b0f.js +0 -257
package/dist/index.d.ts CHANGED
@@ -1496,7 +1496,7 @@ export declare interface IUnitInputProps {
1496
1496
  left?: boolean;
1497
1497
  small?: boolean;
1498
1498
  width?: string | number;
1499
- value?: string | number;
1499
+ value?: string;
1500
1500
  unitkey?: string;
1501
1501
  initUnit?: string;
1502
1502
  noConversion?: boolean;
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ 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
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, convertSamePrecision, withUnit, getValue as getValue$1, split as split$1, getUnit, checkAndCleanDecimalComma, label as label$b, altUnitsList } from "@oliasoft-open-source/units";
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";
15
15
  import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
16
16
  const global$2 = "";
17
17
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -70138,20 +70138,29 @@ const isWrongValue = (val) => {
70138
70138
  return val === "undefined" || val === void 0 || val === "" || val === "null" || val === null || val === "NaN" || isNaN(val);
70139
70139
  };
70140
70140
  const convertUnit = (stringValue = "", toUnit, defaultFromUnit = "", doNotConvertValue = false) => {
70141
- if (toUnit && !doNotConvertValue) {
70141
+ if (doNotConvertValue)
70142
+ return stringValue;
70143
+ if (toUnit && !isWrongValue(stringValue)) {
70142
70144
  try {
70143
- const result = isWrongValue(stringValue) ? stringValue : isValueWithUnit(stringValue) ? convertSamePrecision(stringValue, toUnit) : convertSamePrecision(withUnit(stringValue, defaultFromUnit), toUnit);
70145
+ const valueWithUnit = isValueWithUnit(stringValue) ? stringValue : withUnit(stringValue, defaultFromUnit);
70146
+ const result = convertSamePrecision(valueWithUnit, toUnit);
70144
70147
  return getValue$1(result);
70145
70148
  } catch (e2) {
70146
70149
  }
70147
70150
  }
70148
- return "";
70151
+ return stringValue;
70149
70152
  };
70150
70153
  const safeConvertValue = (value = "", toUnit, defaultFromUnit, doNotConvertValue) => {
70154
+ if (doNotConvertValue)
70155
+ return value;
70151
70156
  const isWithUnit = isValueWithUnit(value);
70152
- const isNullEmptyUndefined = isWithUnit && isWrongValue(getValue$1(value)) || !isWithUnit && isWrongValue(value);
70153
- const convertedValue = isWithUnit ? !isNullEmptyUndefined ? convertUnit(getValue$1(value), toUnit, defaultFromUnit, doNotConvertValue) : "" : !isNullEmptyUndefined ? value : "";
70154
- return convertedValue;
70157
+ const rawValue = getValue$1(value);
70158
+ const isInvalidInput = isWrongValue(rawValue);
70159
+ if (isInvalidInput)
70160
+ return rawValue;
70161
+ if (!isWithUnit)
70162
+ return value;
70163
+ return convertUnit(rawValue, toUnit, defaultFromUnit, doNotConvertValue);
70155
70164
  };
70156
70165
  const getStringName = (name2) => {
70157
70166
  if (isObject$5(name2) && !isArray$1(name2) && !isFunction$3(name2)) {
@@ -70198,6 +70207,14 @@ const validate = (value, options) => {
70198
70207
  }
70199
70208
  return null;
70200
70209
  };
70210
+ const isUnitKnown = (unit2 = "") => {
70211
+ var _a;
70212
+ return (_a = KNOWN_UNITS) == null ? void 0 : _a.includes(unit2);
70213
+ };
70214
+ const isKnownUnit = (valueWithUnit, defaultUnit) => {
70215
+ const unitFromValue = getUnit(valueWithUnit || "");
70216
+ return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
70217
+ };
70201
70218
  const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
70202
70219
  const styles = {
70203
70220
  predefinedMenuActive
@@ -70246,6 +70263,7 @@ const UnitInput = ({
70246
70263
  () => getPreferredUnit(unitkey, unitTemplate),
70247
70264
  [unitkey, unitTemplate]
70248
70265
  );
70266
+ const knownUnit = isKnownUnit(value, defaultUnit);
70249
70267
  const initDisplayUnit = initUnit || defaultUnit || propUnit;
70250
70268
  const previousInitUnit = usePrevious(initDisplayUnit);
70251
70269
  const convertedValue = safeConvertValue(
@@ -70273,14 +70291,14 @@ const UnitInput = ({
70273
70291
  }
70274
70292
  const predefinedMenuItemUnit = isValueWithUnit(el2.value) ? getUnit(el2.value) : "";
70275
70293
  return withUnit(
70276
- convertUnit(String(value), predefinedMenuItemUnit),
70294
+ convertUnit(value, predefinedMenuItemUnit),
70277
70295
  predefinedMenuItemUnit
70278
70296
  ) === el2.value;
70279
70297
  });
70280
70298
  const getAlternativeUnits = () => {
70281
70299
  if (unitkey) {
70282
70300
  try {
70283
- const valueToList = String(isAutoValue ? autoValue : value ?? "");
70301
+ const valueToList = isAutoValue ? autoValue : value ?? "";
70284
70302
  let alternativeUnits2 = altUnitsList(valueToList, unitkey);
70285
70303
  if (getValue$1(valueToList) === "") {
70286
70304
  return alternativeUnits2.map((unitRow) => ["", unitRow[1]]);
@@ -70339,22 +70357,25 @@ const UnitInput = ({
70339
70357
  useEffect(() => {
70340
70358
  if (initDisplayUnit) {
70341
70359
  let newValue, newUnit = "";
70342
- if (previousInitUnit !== initDisplayUnit) {
70360
+ if (previousInitUnit !== initDisplayUnit && knownUnit) {
70343
70361
  newValue = safeConvertValue(
70344
- String(value),
70362
+ value,
70345
70363
  initDisplayUnit,
70346
70364
  propUnit,
70347
70365
  doNotConvertValue
70348
70366
  );
70349
70367
  newUnit = initDisplayUnit;
70350
- } else if (withUnit(displayLayer.value, displayLayer.unit) !== value) {
70368
+ } else if (withUnit(displayLayer.value, displayLayer.unit) !== value && knownUnit) {
70351
70369
  newValue = safeConvertValue(
70352
- String(value),
70370
+ value,
70353
70371
  displayLayer.unit,
70354
70372
  propUnit,
70355
70373
  doNotConvertValue
70356
70374
  );
70357
70375
  newUnit = displayLayer.unit;
70376
+ } else if (!knownUnit) {
70377
+ newValue = getValue$1(value ?? "");
70378
+ newUnit = initDisplayUnit;
70358
70379
  }
70359
70380
  if (newValue !== void 0) {
70360
70381
  setDisplayLayer({ value: newValue, unit: newUnit });
@@ -70367,10 +70388,7 @@ const UnitInput = ({
70367
70388
  }
70368
70389
  }
70369
70390
  }
70370
- const cleanValue = withUnit(
70371
- checkAndCleanDecimalComma(propValue),
70372
- (displayLayer == null ? void 0 : displayLayer.unit) || ""
70373
- );
70391
+ const cleanValue = checkAndCleanDecimalComma(propValue);
70374
70392
  const errorMessage = validate(cleanValue, {
70375
70393
  allowEmpty,
70376
70394
  autoValue,