@oliasoft-open-source/react-ui-library 4.10.4 → 4.10.5-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 (36) hide show
  1. package/dist/index.js +29 -9
  2. package/dist/index.js.map +1 -1
  3. package/dist/storybook/assets/{Color-KGDBMAHA-B_oER2eh.js → Color-KGDBMAHA-Clo6H3WP.js} +1 -1
  4. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-BOKNVKu9.js → DocsRenderer-PKQXORMH-gpTLkmsi.js} +1 -1
  5. package/dist/storybook/assets/{accordion.stories-BLEGXECa.js → accordion.stories-Cf8mC4Vz.js} +1 -1
  6. package/dist/storybook/assets/{buttons-and-links-C9hhQd51.js → buttons-and-links-DzAIMXeO.js} +1 -1
  7. package/dist/storybook/assets/{casing-loads.stories-BCXgA6_-.js → casing-loads.stories-C-zpBzFl.js} +1 -1
  8. package/dist/storybook/assets/{cell.stories-CrIM0y6t.js → cell.stories-C_TxsFop.js} +1 -1
  9. package/dist/storybook/assets/{chunk-HLWAVYOI-BfZEBT2B.js → chunk-HLWAVYOI-Dj2MWya0.js} +1 -1
  10. package/dist/storybook/assets/{color-BHnVca7t.js → color-CZN-p4aM.js} +1 -1
  11. package/dist/storybook/assets/{footer.stories-BU-TGwM2.js → footer.stories-DhXi3lug.js} +1 -1
  12. package/dist/storybook/assets/{formation.stories-DxVe8Zyc.js → formation.stories-EQAgZUkh.js} +1 -1
  13. package/dist/storybook/assets/{iframe-b7FGO4kK.js → iframe-9ccGSytp.js} +2 -2
  14. package/dist/storybook/assets/{index-D0InYQf6.js → index-B3iLD3UY.js} +1 -1
  15. package/dist/storybook/assets/{index-DTpGZ2PI.js → index-DGBZhlHG.js} +88 -88
  16. package/dist/storybook/assets/{input-validation-BpiPuwVL.js → input-validation-BA1-pp__.js} +1 -1
  17. package/dist/storybook/assets/{inputs-Cnu7J7Dg.js → inputs-B4D_ZFgy.js} +1 -1
  18. package/dist/storybook/assets/{layout-forms-QYlS6UGn.js → layout-forms-BkDnEJwQ.js} +1 -1
  19. package/dist/storybook/assets/{layout-general-DAhM0iBJ.js → layout-general-DHM5VM3D.js} +1 -1
  20. package/dist/storybook/assets/{number-input-B5ReSBSL.js → number-input-DOZPfwJP.js} +2 -2
  21. package/dist/storybook/assets/{number-input.stories-DMAU21wG.js → number-input.stories-u2pq69wU.js} +1 -1
  22. package/dist/storybook/assets/{padding-and-spacing-DIn5b2MK.js → padding-and-spacing-CUJJ9GU5.js} +1 -1
  23. package/dist/storybook/assets/{preview-CSnr1bcK.js → preview-CEXyF-6g.js} +1 -1
  24. package/dist/storybook/assets/{preview-D2MA-QXv.js → preview-FMbzOyLt.js} +2 -2
  25. package/dist/storybook/assets/{row.stories-C8rG1yoB.js → row.stories-DjHAdpK1.js} +1 -1
  26. package/dist/storybook/assets/{table-DdpQxqOc.js → table-B9IPSqY5.js} +1 -1
  27. package/dist/storybook/assets/{table.stories-D4zMbjkS.js → table.stories-W86Jdvf5.js} +1 -1
  28. package/dist/storybook/assets/{title.stories-hThIUrWl.js → title.stories-BGrrprew.js} +1 -1
  29. package/dist/storybook/assets/unit-input.stories-DMU1BH5_.js +426 -0
  30. package/dist/storybook/assets/{unit-table.stories-CEqyw4pW.js → unit-table.stories-CL-Uxx5D.js} +1 -1
  31. package/dist/storybook/iframe.html +1 -1
  32. package/dist/storybook/index.json +1 -1
  33. package/dist/storybook/project.json +1 -1
  34. package/package.json +1 -1
  35. package/dist/404.html +0 -1
  36. package/dist/storybook/assets/unit-input.stories-CkeTteis.js +0 -421
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 { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, roundToFixed, validateNumber, cleanNumStr, stripLeadingZeros, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, label as label$b, isValidNum, altUnitsList, convertAndGetValue, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
19
+ import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, roundToFixed, validateNumber, isValueWithUnit, getValue as getValue$1, cleanNumStr, stripLeadingZeros, unitFromQuantity, withUnit, convertSamePrecision, getUnit, KNOWN_UNITS, split as split$1, label as label$b, isValidNum, 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;
@@ -55688,6 +55688,12 @@ const NumberInput = ({
55688
55688
  }) => {
55689
55689
  const validateInputValue = (value2) => {
55690
55690
  const validation = validateNumber(value2);
55691
+ const isPlaceholder = placeholder3 && isEmptyNullOrUndefined(
55692
+ isValueWithUnit(value2) ? getValue$1(String(value2)) : value2
55693
+ );
55694
+ if (isPlaceholder) {
55695
+ return { valid: true, errors: [] };
55696
+ }
55691
55697
  if (allowEmpty && value2 === "" || validation.valid) {
55692
55698
  return { ...validation, valid: true, errors: void 0 };
55693
55699
  } else {
@@ -55733,7 +55739,7 @@ const NumberInput = ({
55733
55739
  value2.replaceAll(" ", "").replaceAll("|", "")
55734
55740
  );
55735
55741
  setDisplayValue(inputValue);
55736
- if ((_b = validateInputValue(inputValue)) == null ? void 0 : _b.valid) {
55742
+ if (((_b = validateInputValue(inputValue)) == null ? void 0 : _b.valid) || placeholder3 && isEmptyNullOrUndefined(value2)) {
55737
55743
  const event = {
55738
55744
  ...evt,
55739
55745
  target: {
@@ -70296,7 +70302,7 @@ const UnitInput = ({
70296
70302
  initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70297
70303
  );
70298
70304
  const isAutoValue = propValue === "" && autoValue;
70299
- const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || placeholder3 && isEmptyNullOrUndefined(value));
70305
+ const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue);
70300
70306
  const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
70301
70307
  if (!(el2 == null ? void 0 : el2.value)) return;
70302
70308
  if (selectedPredefinedOptionKey) {
@@ -70437,6 +70443,25 @@ const UnitInput = ({
70437
70443
  const dynamicOptions = predefinedOptions.map(createPredefinedOption);
70438
70444
  sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
70439
70445
  }
70446
+ const getPlaceholder = (placeholder22) => {
70447
+ if (isAutoValue) {
70448
+ return safeConvertValue(
70449
+ autoValue,
70450
+ displayLayer.unit,
70451
+ propAutoUnit,
70452
+ doNotConvertValue
70453
+ );
70454
+ } else if (isValueWithUnit(placeholder22)) {
70455
+ const placeholderUnit = getUnit(placeholder22);
70456
+ return safeConvertValue(
70457
+ placeholder22,
70458
+ displayLayer.unit,
70459
+ placeholderUnit,
70460
+ doNotConvertValue
70461
+ );
70462
+ }
70463
+ return placeholder22;
70464
+ };
70440
70465
  return /* @__PURE__ */ jsx(
70441
70466
  "div",
70442
70467
  {
@@ -70477,12 +70502,7 @@ const UnitInput = ({
70477
70502
  name: stringName,
70478
70503
  testId,
70479
70504
  disabled: disabled2,
70480
- placeholder: isAutoValue ? safeConvertValue(
70481
- autoValue,
70482
- displayLayer.unit,
70483
- propAutoUnit,
70484
- doNotConvertValue
70485
- ) : placeholder3,
70505
+ placeholder: getPlaceholder(placeholder3),
70486
70506
  value: displayLayer.value,
70487
70507
  onChange: onSetValue,
70488
70508
  onFocus,