@oliasoft-open-source/react-ui-library 10.0.0-beta-44 → 10.0.0-beta-46

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 +97 -79
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2655,7 +2655,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
2655
2655
  let t = d(Nr);
2656
2656
  return f(() => {
2657
2657
  e.current = t ? {
2658
- close: () => t.close(),
2658
+ close: () => t.setOpen(!1),
2659
2659
  open: () => {
2660
2660
  t.isOpen || t.open(null, "input");
2661
2661
  }
@@ -2798,87 +2798,94 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
2798
2798
  searchText: r.toLowerCase()
2799
2799
  };
2800
2800
  }, Fc = (e) => Pr(e) ? [] : Array.isArray(e) ? e.map(String) : [String(e)], Ic = ({ options: e, onCreate: t, onChange: n, selectedOptions: r, width: i = null, small: a, placeholder: o = "", autoLayerWidth: s = !1, isMulti: c, closeOnOptionActionClick: l, searchable: d = !0 }) => {
2801
- let f = !!t, p = cc(), m = v(null), h = v(!1), [_, b] = y(!1), x = g(() => e.map((e, t) => Pc(e, t)), [e]), { searchValue: S, committedFilter: C, isFilterPending: w, onChangeSearch: T, resetSearchState: E } = Nc({
2802
- optionsCount: x.length,
2801
+ let f = !!t, p = cc(), m = v(null), h = v(!1), _ = v(null), [b, x] = y(!1), S = g(() => e.map((e, t) => Pc(e, t)), [e]), { searchValue: C, committedFilter: w, isFilterPending: T, onChangeSearch: E, resetSearchState: D } = Nc({
2802
+ optionsCount: S.length,
2803
2803
  comboBoxStateRef: m
2804
- }), D = u(() => {
2804
+ }), O = u(() => {
2805
2805
  if (l) {
2806
2806
  var e;
2807
2807
  (e = m.current) == null || e.close();
2808
2808
  }
2809
- }, [l]), O = u((e) => {
2810
- b(e), e || E();
2811
- }, [E]), k = i === "auto" || s, A = g(() => k ? Tc(e, a, p, o == null ? "" : o) : 0, [
2812
- k,
2809
+ }, [l]), k = u((e) => {
2810
+ x(e), e || D();
2811
+ }, [D]), A = i === "auto" || s, j = g(() => A ? Tc(e, a, p, o == null ? "" : o) : 0, [
2812
+ A,
2813
2813
  e,
2814
2814
  a,
2815
2815
  p,
2816
2816
  o
2817
- ]), j = u(() => i ? i === "auto" ? A : i : "100%", [i, A]), M = u((e) => {
2817
+ ]), M = u(() => i ? i === "auto" ? j : i : "100%", [i, j]), N = u((e) => {
2818
2818
  var t;
2819
- let n = j(), r = (t = e == null ? void 0 : e.getBoundingClientRect().width) == null ? typeof n == "number" ? n : 0 : t;
2820
- return s ? Math.max(A, r) : r;
2819
+ let n = M(), r = (t = e == null ? void 0 : e.getBoundingClientRect().width) == null ? typeof n == "number" ? n : 0 : t;
2820
+ return s ? Math.max(j, r) : r;
2821
2821
  }, [
2822
2822
  s,
2823
- A,
2824
- j
2825
- ]), N = g(() => {
2823
+ j,
2824
+ M
2825
+ ]), P = g(() => {
2826
2826
  let e = /* @__PURE__ */ new Map();
2827
- for (let t of x) e.set(t.id, t);
2827
+ for (let t of S) e.set(t.id, t);
2828
2828
  return e;
2829
- }, [x]), P = g(() => {
2829
+ }, [S]), F = g(() => {
2830
2830
  if (c) return (Array.isArray(r) ? r : []).filter((e) => e && !Pr(e.value)).map((e) => String(e.value));
2831
2831
  let e = Array.isArray(r) ? r[0] : r;
2832
2832
  return Pr(e == null ? void 0 : e.value) ? null : String(e.value);
2833
- }, [c, r]), F = g(() => c ? Array.isArray(P) ? P : [] : Pr(P) ? [] : [P], [P, c]), I = g(() => {
2834
- if (d && w && !C.trim()) return F.length === 0 ? [] : x.filter((e) => F.includes(e.id));
2835
- let e = d ? C.trim().toLowerCase() : "", t = e ? x.filter((t) => t.searchText.includes(e)) : x;
2833
+ }, [c, r]), I = g(() => c ? Array.isArray(F) ? F : [] : Pr(F) ? [] : [F], [F, c]), L = g(() => {
2834
+ if (d && T && !w.trim()) return I.length === 0 ? [] : S.filter((e) => I.includes(e.id));
2835
+ let e = d ? w.trim().toLowerCase() : "", t = e ? S.filter((t) => t.searchText.includes(e)) : S;
2836
2836
  return f && e ? [...t, {
2837
2837
  id: Oc,
2838
- label: `Create "${C}"`,
2839
- value: C,
2838
+ label: `Create "${w}"`,
2839
+ value: w,
2840
2840
  createAble: !0,
2841
- textValue: `Create "${C}"`
2841
+ textValue: `Create "${w}"`
2842
2842
  }] : t;
2843
2843
  }, [
2844
- x,
2845
- C,
2844
+ S,
2845
+ w,
2846
2846
  f,
2847
2847
  d,
2848
- w,
2849
- F
2850
- ]), L = g(() => {
2848
+ T,
2849
+ I
2850
+ ]), R = g(() => {
2851
2851
  if (c) {
2852
2852
  let e = Array.isArray(r) ? r[0] : null;
2853
2853
  return Pr(e == null ? void 0 : e.value) ? null : String(e.value);
2854
2854
  }
2855
- return P;
2855
+ return F;
2856
2856
  }, [
2857
- P,
2857
+ F,
2858
2858
  c,
2859
2859
  r
2860
- ]), R = u((e) => {
2860
+ ]), z = u((e) => {
2861
+ if (!c) {
2862
+ var t;
2863
+ (t = m.current) == null || t.close();
2864
+ }
2861
2865
  n == null || n({ target: {} }, e);
2862
- }, [n]), z = u((e = S) => {
2863
- if (!(!t || !e) && (h.current = !0, t(e), E(), !c)) {
2864
- var n;
2865
- (n = m.current) == null || n.close();
2866
+ }, [n, c]), B = u((e = C) => {
2867
+ if (!(!t || !e)) {
2868
+ if (h.current = !0, !c) {
2869
+ var n;
2870
+ (n = m.current) == null || n.close();
2871
+ }
2872
+ t(e), D();
2866
2873
  }
2867
2874
  }, [
2868
- S,
2875
+ C,
2869
2876
  c,
2870
2877
  t,
2871
- E
2872
- ]), B = u((e) => {
2873
- if (E(), c) {
2878
+ D
2879
+ ]), ee = u((e) => {
2880
+ if (D(), c) {
2874
2881
  let t = Fc(e);
2875
2882
  if (t.includes("create")) {
2876
- z();
2883
+ B();
2877
2884
  return;
2878
2885
  }
2879
- let n = Array.isArray(P) ? P : [];
2886
+ let n = Array.isArray(F) ? F : [];
2880
2887
  if (t.length === n.length && t.every((e) => n.includes(e))) return;
2881
- let r = t.map((e) => N.get(e)).filter((e) => !Pr(e) && e.type !== Qa.HEADING).map((e) => ({
2888
+ let r = t.map((e) => P.get(e)).filter((e) => !Pr(e) && e.type !== Qa.HEADING).map((e) => ({
2882
2889
  value: e.value,
2883
2890
  label: e.label,
2884
2891
  details: e.details,
@@ -2886,7 +2893,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
2886
2893
  actions: e.actions,
2887
2894
  testId: e.testId
2888
2895
  }));
2889
- R(r);
2896
+ z(r);
2890
2897
  return;
2891
2898
  }
2892
2899
  let t = Array.isArray(e) ? e[0] : e;
@@ -2895,51 +2902,61 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
2895
2902
  h.current = !1;
2896
2903
  return;
2897
2904
  }
2898
- if (!Pr(P)) return;
2899
- R({ value: null });
2905
+ if (!Pr(F)) return;
2906
+ z({ value: null });
2900
2907
  return;
2901
2908
  }
2902
2909
  if (String(t) === "create") {
2903
- z();
2910
+ B();
2904
2911
  return;
2905
2912
  }
2906
- if (String(t) === P) return;
2907
- let n = N.get(String(t));
2908
- !n || n.type === Qa.HEADING || n.disabled || n.createAble || R({
2913
+ let n = P.get(String(t));
2914
+ if (!n || n.type === Qa.HEADING || n.disabled || n.createAble) return;
2915
+ let r = String(t);
2916
+ _.current !== r && (_.current = r, Promise.resolve().then(() => {
2917
+ _.current === r && (_.current = null);
2918
+ }), z({
2909
2919
  value: n.value,
2910
2920
  label: n.label,
2911
2921
  details: n.details,
2912
2922
  icon: n.icon,
2913
2923
  actions: n.actions,
2914
2924
  testId: n.testId
2915
- });
2925
+ }));
2916
2926
  }, [
2917
- E,
2918
- P,
2919
- R,
2927
+ D,
2928
+ F,
2920
2929
  z,
2930
+ B,
2921
2931
  c,
2922
- N
2932
+ P
2923
2933
  ]);
2924
2934
  return {
2925
- getTriggerWidth: j,
2926
- onChangeSearch: T,
2935
+ getTriggerWidth: M,
2936
+ onChangeSearch: E,
2927
2937
  onClickClearAll: u(() => {
2928
- E(), R(c ? [] : { value: null });
2938
+ D(), z(c ? [] : { value: null });
2929
2939
  }, [
2930
- E,
2931
- R,
2940
+ D,
2941
+ z,
2932
2942
  c
2933
2943
  ]),
2934
- closeLayer: D,
2935
- handleChange: B,
2936
- getLayerWidth: M,
2937
- searchValue: S,
2938
- isOpen: _,
2939
- setIsOpen: O,
2940
- visibleOptions: I,
2941
- comboValue: P,
2942
- selectedItemId: L,
2944
+ closeLayer: O,
2945
+ handleChange: ee,
2946
+ handleSelectionChange: u((e) => {
2947
+ c || !Pr(e) && String(e) === String(F) && ee(e);
2948
+ }, [
2949
+ c,
2950
+ F,
2951
+ ee
2952
+ ]),
2953
+ getLayerWidth: N,
2954
+ searchValue: C,
2955
+ isOpen: b,
2956
+ setIsOpen: k,
2957
+ visibleOptions: L,
2958
+ comboValue: F,
2959
+ selectedItemId: R,
2943
2960
  comboBoxStateRef: m
2944
2961
  };
2945
2962
  }, Lc = ({ items: e, optionsCount: t, selectedItemId: n, width: r, small: i, isMulti: a = !1, closeLayer: o, testId: s }) => {
@@ -3153,7 +3170,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3153
3170
  children: A
3154
3171
  }) });
3155
3172
  }, Wc = () => !0, Gc = (e) => {
3156
- let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions: s, onChange: c, onCreate: l = null, placeholder: u = "", small: f = !1, tabIndex: p = 0, onFocus: m = Ir, onBlur: g = Ir, searchable: _ = !0, clearable: b = !1, maxTooltipWidth: x, closeOnOptionActionClick: S, isInTable: T = !1, groupOrder: E, right: D = !1, width: O = null, autoLayerWidth: k = !1, testId: A } = e, j = d(W), M = n || j, N = v(null), [P, F] = y(0), { getTriggerWidth: I, onChangeSearch: L, onClickClearAll: R, closeLayer: z, handleChange: B, getLayerWidth: ee, searchValue: te, isOpen: ne, setIsOpen: V, visibleOptions: re, comboValue: ie, selectedItemId: ae, comboBoxStateRef: oe } = Ic({
3173
+ let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions: s, onChange: c, onCreate: l = null, placeholder: u = "", small: f = !1, tabIndex: p = 0, onFocus: m = Ir, onBlur: g = Ir, searchable: _ = !0, clearable: b = !1, maxTooltipWidth: x, closeOnOptionActionClick: S, isInTable: T = !1, groupOrder: E, right: D = !1, width: O = null, autoLayerWidth: k = !1, testId: A } = e, j = d(W), M = n || j, N = v(null), [P, F] = y(0), { getTriggerWidth: I, onChangeSearch: L, onClickClearAll: R, closeLayer: z, handleChange: B, handleSelectionChange: ee, getLayerWidth: te, searchValue: ne, isOpen: V, setIsOpen: re, visibleOptions: ie, comboValue: ae, selectedItemId: oe, comboBoxStateRef: se } = Ic({
3157
3174
  options: o,
3158
3175
  onCreate: l,
3159
3176
  onChange: c,
@@ -3167,27 +3184,28 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3167
3184
  searchable: _
3168
3185
  });
3169
3186
  return h(() => {
3170
- ne && F(ee(N.current));
3171
- }, [ee, ne]), /* @__PURE__ */ w(Mr, {
3187
+ V && F(te(N.current));
3188
+ }, [te, V]), /* @__PURE__ */ w(Mr, {
3172
3189
  "aria-label": u || "Select",
3173
3190
  className: ac.select,
3174
3191
  style: { width: I() },
3175
3192
  isDisabled: M,
3176
3193
  selectionMode: t ? "multiple" : "single",
3177
- value: ie,
3194
+ value: ae,
3178
3195
  onChange: B,
3179
- inputValue: te,
3196
+ onSelectionChange: ee,
3197
+ inputValue: ne,
3180
3198
  onInputChange: _ ? L : void 0,
3181
- items: re,
3199
+ items: ie,
3182
3200
  defaultFilter: Wc,
3183
3201
  allowsEmptyCollection: !0,
3184
3202
  menuTrigger: "manual",
3185
- onOpenChange: V,
3203
+ onOpenChange: re,
3186
3204
  children: [
3187
- /* @__PURE__ */ C(oc, { stateRef: oe }),
3205
+ /* @__PURE__ */ C(oc, { stateRef: se }),
3188
3206
  /* @__PURE__ */ C(Uc, {
3189
3207
  selectedOptions: s,
3190
- searchValue: te,
3208
+ searchValue: ne,
3191
3209
  searchable: _,
3192
3210
  clearable: b,
3193
3211
  error: r,
@@ -3198,7 +3216,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3198
3216
  disabled: M,
3199
3217
  onClickClear: R,
3200
3218
  tabIndex: p,
3201
- isOpen: ne,
3219
+ isOpen: V,
3202
3220
  triggerRef: N,
3203
3221
  onFocus: m,
3204
3222
  onBlur: g,
@@ -3215,9 +3233,9 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3215
3233
  triggerRef: N,
3216
3234
  offset: 0,
3217
3235
  children: /* @__PURE__ */ C(Lc, {
3218
- items: re,
3236
+ items: ie,
3219
3237
  optionsCount: o.length,
3220
- selectedItemId: ae,
3238
+ selectedItemId: oe,
3221
3239
  width: P,
3222
3240
  small: f,
3223
3241
  isMulti: t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "10.0.0-beta-44",
3
+ "version": "10.0.0-beta-46",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {