@oliasoft-open-source/react-ui-library 4.2.1-beta-2 → 4.2.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 (28) hide show
  1. package/dist/404.html +1 -0
  2. package/dist/index.js +17 -5
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-6VNJS4EI-6b48c85b.js → Color-6VNJS4EI-11a1508d.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-25c0f625.js → DocsRenderer-NNNQARDV-8f214a0a.js} +1 -1
  6. package/dist/storybook/assets/{WithTooltip-4HIR6TLV-9ebd09dc.js → WithTooltip-4HIR6TLV-bcdb019a.js} +1 -1
  7. package/dist/storybook/assets/{buttons-and-links-16cf8577.js → buttons-and-links-72daa9ae.js} +1 -1
  8. package/dist/storybook/assets/{chunk-HLWAVYOI-1c498991.js → chunk-HLWAVYOI-6a96cff0.js} +1 -1
  9. package/dist/storybook/assets/{color-8b40ecf4.js → color-9bdf643a.js} +1 -1
  10. package/dist/storybook/assets/{formatter-SWP5E3XI-521171e8.js → formatter-SWP5E3XI-06c7911e.js} +1 -1
  11. package/dist/storybook/assets/{iframe-5eee0790.js → iframe-c1fab5c5.js} +1 -1
  12. package/dist/storybook/assets/{index-665bded2.js → index-97b8789c.js} +4 -4
  13. package/dist/storybook/assets/{input-validation-560fd9e3.js → input-validation-64e7abcc.js} +1 -1
  14. package/dist/storybook/assets/{inputs-ed0fc7ad.js → inputs-e48e1acb.js} +1 -1
  15. package/dist/storybook/assets/{layout-forms-e9b95540.js → layout-forms-289235b9.js} +1 -1
  16. package/dist/storybook/assets/{layout-general-7a81d7f9.js → layout-general-545e69b0.js} +1 -1
  17. package/dist/storybook/assets/{padding-and-spacing-ea2bf22c.js → padding-and-spacing-7aefd342.js} +1 -1
  18. package/dist/storybook/assets/preview-5405e1e8.js +1 -0
  19. package/dist/storybook/assets/{preview-51e87244.js → preview-88cc5d68.js} +1 -1
  20. package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-96abff19.js → syntaxhighlighter-NMPM6SWI-5e884b35.js} +1 -1
  21. package/dist/storybook/assets/unit-input.stories-50ac8b0f.js +257 -0
  22. package/dist/storybook/iframe.html +1 -1
  23. package/dist/storybook/index.json +1 -1
  24. package/dist/storybook/project.json +1 -1
  25. package/dist/storybook/stories.json +1 -1
  26. package/package.json +1 -1
  27. package/dist/storybook/assets/preview-987fd1ab.js +0 -1
  28. package/dist/storybook/assets/unit-input.stories-0eea1703.js +0 -265
package/dist/404.html ADDED
@@ -0,0 +1 @@
1
+ <!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-26f804a8.js"></script><link rel="stylesheet" href="/react-ui-library/assets/index-0d78a198.css"></head><body><div id="content"></div></body>
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, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, split as split$1, 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 : {};
@@ -70156,15 +70156,18 @@ const isValueWithUnknownUnit = (value) => {
70156
70156
  return Boolean(getUnit(value));
70157
70157
  };
70158
70158
  const safeConvertValue = (value = "", toUnit, defaultFromUnit, doNotConvertValue) => {
70159
- if (doNotConvertValue)
70159
+ if (doNotConvertValue) {
70160
70160
  return value;
70161
+ }
70161
70162
  const isWithUnit = isValueWithUnknownUnit(value) || isValueWithUnit(value);
70162
70163
  const rawValue = getValue$1(value);
70163
70164
  const isInvalidInput = isWrongValue(rawValue);
70164
- if (isInvalidInput)
70165
+ if (isInvalidInput) {
70165
70166
  return rawValue;
70166
- if (!isWithUnit)
70167
+ }
70168
+ if (!isWithUnit) {
70167
70169
  return value;
70170
+ }
70168
70171
  return convertUnit(rawValue, toUnit, defaultFromUnit, doNotConvertValue);
70169
70172
  };
70170
70173
  const getStringName = (name2) => {
@@ -70212,6 +70215,14 @@ const validate = (value, options) => {
70212
70215
  }
70213
70216
  return null;
70214
70217
  };
70218
+ const isUnitKnown = (unit2 = "") => {
70219
+ var _a;
70220
+ return (_a = KNOWN_UNITS) == null ? void 0 : _a.includes(unit2);
70221
+ };
70222
+ const isKnownUnit = (valueWithUnit, defaultUnit) => {
70223
+ const unitFromValue = getUnit(valueWithUnit || "");
70224
+ return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
70225
+ };
70215
70226
  const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
70216
70227
  const styles = {
70217
70228
  predefinedMenuActive
@@ -70260,6 +70271,7 @@ const UnitInput = ({
70260
70271
  () => getPreferredUnit(unitkey, unitTemplate),
70261
70272
  [unitkey, unitTemplate]
70262
70273
  );
70274
+ const knownUnit = isKnownUnit(value, defaultUnit);
70263
70275
  const initDisplayUnit = initUnit || defaultUnit || propUnit;
70264
70276
  const previousInitUnit = usePrevious(initDisplayUnit);
70265
70277
  const convertedValue = safeConvertValue(
@@ -70500,7 +70512,7 @@ const UnitInput = ({
70500
70512
  },
70501
70513
  stringName
70502
70514
  ),
70503
- displayUnitLabel && (noConvert ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
70515
+ displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
70504
70516
  Menu,
70505
70517
  {
70506
70518
  maxHeight: 380,