@oliasoft-open-source/react-ui-library 5.11.7-beta-5 → 5.11.7-beta-6

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 +25 -28
  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: zd } = 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(zd),
2812
+ width: q(Rd),
2813
2813
  small: d,
2814
2814
  focusedOptionIndex: N.layerFocus.current,
2815
2815
  firstSelectedOptionIndex: C ?? 0,
@@ -4231,15 +4231,12 @@ var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e &
4231
4231
  })}`);
4232
4232
  });
4233
4233
  }), r;
4234
- }, resolveEffectiveRules = (e, t) => {
4235
- let n = e.filter((e) => !e.optionalColumn);
4236
- return t === n.length ? n : (e.length, e);
4237
4234
  };
4238
4235
  const validate = (e, t, n, r, i, a, o) => {
4239
- let s = n.reduce((e, t) => Math.max(e, t.length), 0), c = Math.max(e.length, t.length, s), l = resolveEffectiveRules(r, c), u = validateColumnLength(e, t, n, l, i, a, o);
4240
- return u.length === 0 && (u = u.concat(validateHeadings(e, t, l, i, a, o), validateValues(n, l, o))), {
4241
- isValid: u.length === 0,
4242
- errors: u
4236
+ let s = validateColumnLength(e, t, n, r, i, a, o);
4237
+ return s.length === 0 && (s = s.concat(validateHeadings(e, t, r, i, a, o), validateValues(n, r, o))), {
4238
+ isValid: s.length === 0,
4239
+ errors: s
4243
4240
  };
4244
4241
  }, hasHeaders = (e, t, n) => {
4245
4242
  let r = (e) => e.replace(/,/g, "."), i = e[0]?.some((e) => isNaN(Number(r(e)))) ?? !1, a = e[1]?.some((e) => isNaN(Number(r(e)))) ?? !1, o = e[0]?.some((e) => t.includes(e)) ?? !1, s = e[0]?.some((e) => n.includes(e)) ?? !1, c = e[1]?.some((e) => n.includes(e)) ?? !1, l = e[0]?.some((e) => !isNaN(Number(r(e)))) ?? !1, u = e[1]?.some((e) => !isNaN(Number(r(e)))) ?? !1;
@@ -6739,7 +6736,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6739
6736
  } : {
6740
6737
  value: G,
6741
6738
  unit: U
6742
- }), zd = k || K?.value === void 0, [J, Bd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Vd = !!(O || n), Y = C && C.find((e) => {
6739
+ }), Rd = k || K?.value === void 0, [J, zd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Bd = !!(O || n), Y = C && C.find((e) => {
6743
6740
  if (!e?.value) return;
6744
6741
  if (E) return E === e.valueKey;
6745
6742
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
@@ -6748,7 +6745,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6748
6745
  toUnit: t
6749
6746
  });
6750
6747
  return withUnit(n, t) === e.value;
6751
- }), Hd = () => {
6748
+ }), Vd = () => {
6752
6749
  let e = l ?? "", t = K.unit;
6753
6750
  if (checkConversion({
6754
6751
  value: e,
@@ -6762,7 +6759,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6762
6759
  return null;
6763
6760
  }
6764
6761
  } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6765
- }, Ud = (t) => {
6762
+ }, Hd = (t) => {
6766
6763
  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;
6767
6764
  h({ target: {
6768
6765
  value: s,
@@ -6775,7 +6772,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6775
6772
  }), R(() => {
6776
6773
  r.selectionStart = a, r.selectionEnd = a;
6777
6774
  });
6778
- }, Wd = (e, t) => {
6775
+ }, Ud = (e, t) => {
6779
6776
  t === K.unit || isNaN(Number(e)) || (q({
6780
6777
  value: e,
6781
6778
  unit: t
@@ -6806,7 +6803,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6806
6803
  e !== void 0 && q({
6807
6804
  value: e,
6808
6805
  unit: t
6809
- }), Bd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6806
+ }), zd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6810
6807
  }
6811
6808
  }, [
6812
6809
  U,
@@ -6814,7 +6811,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6814
6811
  i,
6815
6812
  T
6816
6813
  ]);
6817
- let X = Hd(), Z = label(K.unit) || K.unit || "", Gd = p || !X || X && X.length === 1, Q = getStringName(e), $, Kd = (t) => {
6814
+ let X = Vd(), Z = label(K.unit) || K.unit || "", Wd = p || !X || X && X.length === 1, Q = getStringName(e), $, Gd = (t) => {
6818
6815
  let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6819
6816
  if (checkConversion({
6820
6817
  value: r,
@@ -6834,7 +6831,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6834
6831
  type: MenuType.OPTION,
6835
6832
  inline: !0,
6836
6833
  onClick: () => {
6837
- validateNumber(i).valid && !n && (Bd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6834
+ validateNumber(i).valid && !n && (zd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6838
6835
  value: r,
6839
6836
  name: typeof e == "string" ? e : e?.fieldName || "",
6840
6837
  predefinedSelected: !0,
@@ -6861,10 +6858,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6861
6858
  label: "Custom",
6862
6859
  selected: J === PredefinedOptionsMenuState.CUSTOM
6863
6860
  }], C?.length) {
6864
- let e = C.map(Kd);
6861
+ let e = C.map(Gd);
6865
6862
  $ = [...$, ...e];
6866
6863
  }
6867
- let qd = (e) => {
6864
+ let Kd = (e) => {
6868
6865
  if (isValueWithUnit(e)) {
6869
6866
  let t = getUnit(e), { value: n } = safeConvertValue({
6870
6867
  value: e,
@@ -6876,7 +6873,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6876
6873
  return n;
6877
6874
  }
6878
6875
  return e;
6879
- }, Jd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Yd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6876
+ }, qd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Jd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6880
6877
  return /* @__PURE__ */ jsx("div", {
6881
6878
  className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6882
6879
  children: /* @__PURE__ */ jsxs(InputGroup, {
@@ -6908,31 +6905,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6908
6905
  name: Q,
6909
6906
  testId: x,
6910
6907
  disabled: n,
6911
- placeholder: qd(t),
6908
+ placeholder: Kd(t),
6912
6909
  value: K.value,
6913
- onChange: Ud,
6910
+ onChange: Hd,
6914
6911
  onFocus: v,
6915
6912
  error: i === null ? void 0 : i,
6916
6913
  warning: S === null ? void 0 : S,
6917
6914
  left: a,
6918
- allowEmpty: zd,
6915
+ allowEmpty: Rd,
6919
6916
  validationCallback: (e, t) => D(Q, t),
6920
6917
  enableCosmeticRounding: j,
6921
6918
  enableDisplayRounding: M,
6922
6919
  roundDisplayValue: N,
6923
- groupOrder: Jd,
6924
- disableInternalErrorValidationMessages: Vd,
6920
+ groupOrder: qd,
6921
+ disableInternalErrorValidationMessages: Bd,
6925
6922
  small: o,
6926
6923
  selectOnFocus: P,
6927
6924
  tooltip: I
6928
6925
  }, Q)
6929
6926
  }),
6930
- Z && (Gd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6931
- groupOrder: Yd,
6927
+ Z && (Wd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6928
+ groupOrder: Jd,
6932
6929
  small: o,
6933
6930
  children: Z
6934
6931
  }) : /* @__PURE__ */ jsx(Menu, {
6935
- groupOrder: Yd,
6932
+ groupOrder: Jd,
6936
6933
  maxHeight: 380,
6937
6934
  disabled: r,
6938
6935
  testId: x && `${x}-menu`,
@@ -6948,7 +6945,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6948
6945
  label: j ? safeRoundNumbers(i) : i,
6949
6946
  inline: !0,
6950
6947
  onClick: (n) => {
6951
- n.stopPropagation(), Wd(e, t);
6948
+ n.stopPropagation(), Ud(e, t);
6952
6949
  },
6953
6950
  description: r,
6954
6951
  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.7-beta-5",
3
+ "version": "5.11.7-beta-6",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {