@oliasoft-open-source/react-ui-library 5.11.3 → 5.11.4

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 (2) hide show
  1. package/dist/index.js +28 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2741,7 +2741,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2741
2741
  layerFocus: initialLayerFocus(e, C ?? 0),
2742
2742
  triggerFocus: initialTriggerFocus,
2743
2743
  isLayerOpen: !1
2744
- })), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: Ld } = useCustomSelectLogic({
2744
+ })), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: Rd } = useCustomSelectLogic({
2745
2745
  ...e,
2746
2746
  state: N,
2747
2747
  dispatch: P,
@@ -2809,7 +2809,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2809
2809
  closeLayer: () => {
2810
2810
  b && G();
2811
2811
  },
2812
- width: q(Ld),
2812
+ width: q(Rd),
2813
2813
  small: d,
2814
2814
  focusedOptionIndex: N.layerFocus.current,
2815
2815
  firstSelectedOptionIndex: C ?? 0,
@@ -4253,7 +4253,6 @@ const validate = (e, t, n, r, i, a, o) => {
4253
4253
  }, depthRound = (e) => Math.round(e * 100) / 100;
4254
4254
  var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
4255
4255
  skipEmptyLines: !0,
4256
- transform: (e) => e?.trim(),
4257
4256
  delimiter: (e) => {
4258
4257
  let t = e.substring(0, 200), n = (t.match(/\t/g) ?? []).length, r = (t.match(/;/g) ?? []).length;
4259
4258
  return n === 0 && r === 0 ? "," : n > r ? " " : ";";
@@ -4743,11 +4742,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
4743
4742
  let r = t[e];
4744
4743
  return n ? interpolate(r, n) : r;
4745
4744
  };
4746
- }, [e]), normalizeParsedResult = (e) => {
4745
+ }, [e]);
4746
+ var numericLike = /^\s*-?\d+(?:[.,]\d+)?(?:e[+-]?\d+)?\s*$/i;
4747
+ const normalizeParsedResult = (e) => {
4747
4748
  let { rows: t } = e, n = Array(t.length);
4748
4749
  for (let e = 0; e < t.length; e++) {
4749
4750
  let r = t[e], i = Array(r.length);
4750
- for (let e = 0; e < r.length; e++) i[e] = cleanNumStr(r[e]);
4751
+ for (let e = 0; e < r.length; e++) {
4752
+ let t = String(r[e] ?? "");
4753
+ i[e] = numericLike.test(t) ? cleanNumStr(t) : t;
4754
+ }
4751
4755
  n[e] = i;
4752
4756
  }
4753
4757
  return {
@@ -6731,7 +6735,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6731
6735
  } : {
6732
6736
  value: G,
6733
6737
  unit: U
6734
- }), Ld = k || K?.value === void 0, [J, Rd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), zd = !!(O || n), Y = C && C.find((e) => {
6738
+ }), Rd = k || K?.value === void 0, [J, zd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Bd = !!(O || n), Y = C && C.find((e) => {
6735
6739
  if (!e?.value) return;
6736
6740
  if (E) return E === e.valueKey;
6737
6741
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
@@ -6740,7 +6744,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6740
6744
  toUnit: t
6741
6745
  });
6742
6746
  return withUnit(n, t) === e.value;
6743
- }), Bd = () => {
6747
+ }), Vd = () => {
6744
6748
  let e = l ?? "", t = K.unit;
6745
6749
  if (checkConversion({
6746
6750
  value: e,
@@ -6754,7 +6758,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6754
6758
  return null;
6755
6759
  }
6756
6760
  } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6757
- }, Vd = (t) => {
6761
+ }, Hd = (t) => {
6758
6762
  let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
6759
6763
  h({ target: {
6760
6764
  value: s,
@@ -6767,7 +6771,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6767
6771
  }), R(() => {
6768
6772
  r.selectionStart = a, r.selectionEnd = a;
6769
6773
  });
6770
- }, Hd = (e, t) => {
6774
+ }, Ud = (e, t) => {
6771
6775
  t === K.unit || isNaN(Number(e)) || (q({
6772
6776
  value: e,
6773
6777
  unit: t
@@ -6798,7 +6802,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6798
6802
  e !== void 0 && q({
6799
6803
  value: e,
6800
6804
  unit: t
6801
- }), Rd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6805
+ }), zd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6802
6806
  }
6803
6807
  }, [
6804
6808
  U,
@@ -6806,7 +6810,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6806
6810
  i,
6807
6811
  T
6808
6812
  ]);
6809
- let X = Bd(), Z = label(K.unit) || K.unit || "", Ud = p || !X || X && X.length === 1, Q = getStringName(e), $, Wd = (t) => {
6813
+ let X = Vd(), Z = label(K.unit) || K.unit || "", Wd = p || !X || X && X.length === 1, Q = getStringName(e), $, Gd = (t) => {
6810
6814
  let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6811
6815
  if (checkConversion({
6812
6816
  value: r,
@@ -6826,7 +6830,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6826
6830
  type: MenuType.OPTION,
6827
6831
  inline: !0,
6828
6832
  onClick: () => {
6829
- validateNumber(i).valid && !n && (Rd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6833
+ validateNumber(i).valid && !n && (zd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6830
6834
  value: r,
6831
6835
  name: typeof e == "string" ? e : e?.fieldName || "",
6832
6836
  predefinedSelected: !0,
@@ -6853,10 +6857,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6853
6857
  label: "Custom",
6854
6858
  selected: J === PredefinedOptionsMenuState.CUSTOM
6855
6859
  }], C?.length) {
6856
- let e = C.map(Wd);
6860
+ let e = C.map(Gd);
6857
6861
  $ = [...$, ...e];
6858
6862
  }
6859
- let Gd = (e) => {
6863
+ let Kd = (e) => {
6860
6864
  if (isValueWithUnit(e)) {
6861
6865
  let t = getUnit(e), { value: n } = safeConvertValue({
6862
6866
  value: e,
@@ -6868,7 +6872,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6868
6872
  return n;
6869
6873
  }
6870
6874
  return e;
6871
- }, Kd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, qd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6875
+ }, qd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Jd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6872
6876
  return /* @__PURE__ */ jsx("div", {
6873
6877
  className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6874
6878
  children: /* @__PURE__ */ jsxs(InputGroup, {
@@ -6900,31 +6904,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6900
6904
  name: Q,
6901
6905
  testId: x,
6902
6906
  disabled: n,
6903
- placeholder: Gd(t),
6907
+ placeholder: Kd(t),
6904
6908
  value: K.value,
6905
- onChange: Vd,
6909
+ onChange: Hd,
6906
6910
  onFocus: v,
6907
6911
  error: i === null ? void 0 : i,
6908
6912
  warning: S === null ? void 0 : S,
6909
6913
  left: a,
6910
- allowEmpty: Ld,
6914
+ allowEmpty: Rd,
6911
6915
  validationCallback: (e, t) => D(Q, t),
6912
6916
  enableCosmeticRounding: j,
6913
6917
  enableDisplayRounding: M,
6914
6918
  roundDisplayValue: N,
6915
- groupOrder: Kd,
6916
- disableInternalErrorValidationMessages: zd,
6919
+ groupOrder: qd,
6920
+ disableInternalErrorValidationMessages: Bd,
6917
6921
  small: o,
6918
6922
  selectOnFocus: P,
6919
6923
  tooltip: I
6920
6924
  }, Q)
6921
6925
  }),
6922
- Z && (Ud || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6923
- groupOrder: qd,
6926
+ Z && (Wd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6927
+ groupOrder: Jd,
6924
6928
  small: o,
6925
6929
  children: Z
6926
6930
  }) : /* @__PURE__ */ jsx(Menu, {
6927
- groupOrder: qd,
6931
+ groupOrder: Jd,
6928
6932
  maxHeight: 380,
6929
6933
  disabled: r,
6930
6934
  testId: x && `${x}-menu`,
@@ -6940,7 +6944,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6940
6944
  label: j ? safeRoundNumbers(i) : i,
6941
6945
  inline: !0,
6942
6946
  onClick: (n) => {
6943
- n.stopPropagation(), Hd(e, t);
6947
+ n.stopPropagation(), Ud(e, t);
6944
6948
  },
6945
6949
  description: r,
6946
6950
  selected: r === Z,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.11.3",
3
+ "version": "5.11.4",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {