@oliasoft-open-source/react-ui-library 10.0.0-beta-43 → 10.0.0-beta-45

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 +88 -77
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -904,7 +904,7 @@ var Ma = {
904
904
  }
905
905
  r == null || r(e);
906
906
  },
907
- onPointerDown: (e) => {
907
+ onClickCapture: (e) => {
908
908
  l && (e.preventDefault(), e.stopPropagation());
909
909
  },
910
910
  "data-testid": h,
@@ -2798,87 +2798,87 @@ 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
2861
  n == null || n({ target: {} }, e);
2862
- }, [n]), z = u((e = S) => {
2863
- if (!(!t || !e) && (h.current = !0, t(e), E(), !c)) {
2862
+ }, [n]), B = u((e = C) => {
2863
+ if (!(!t || !e) && (h.current = !0, t(e), D(), !c)) {
2864
2864
  var n;
2865
2865
  (n = m.current) == null || n.close();
2866
2866
  }
2867
2867
  }, [
2868
- S,
2868
+ C,
2869
2869
  c,
2870
2870
  t,
2871
- E
2872
- ]), B = u((e) => {
2873
- if (E(), c) {
2871
+ D
2872
+ ]), ee = u((e) => {
2873
+ if (D(), c) {
2874
2874
  let t = Fc(e);
2875
2875
  if (t.includes("create")) {
2876
- z();
2876
+ B();
2877
2877
  return;
2878
2878
  }
2879
- let n = Array.isArray(P) ? P : [];
2879
+ let n = Array.isArray(F) ? F : [];
2880
2880
  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) => ({
2881
+ let r = t.map((e) => P.get(e)).filter((e) => !Pr(e) && e.type !== Qa.HEADING).map((e) => ({
2882
2882
  value: e.value,
2883
2883
  label: e.label,
2884
2884
  details: e.details,
@@ -2886,7 +2886,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
2886
2886
  actions: e.actions,
2887
2887
  testId: e.testId
2888
2888
  }));
2889
- R(r);
2889
+ z(r);
2890
2890
  return;
2891
2891
  }
2892
2892
  let t = Array.isArray(e) ? e[0] : e;
@@ -2895,51 +2895,61 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
2895
2895
  h.current = !1;
2896
2896
  return;
2897
2897
  }
2898
- if (!Pr(P)) return;
2899
- R({ value: null });
2898
+ if (!Pr(F)) return;
2899
+ z({ value: null });
2900
2900
  return;
2901
2901
  }
2902
2902
  if (String(t) === "create") {
2903
- z();
2903
+ B();
2904
2904
  return;
2905
2905
  }
2906
- if (String(t) === P) return;
2907
- let n = N.get(String(t));
2908
- !n || n.type === Qa.HEADING || n.disabled || n.createAble || R({
2906
+ let n = P.get(String(t));
2907
+ if (!n || n.type === Qa.HEADING || n.disabled || n.createAble) return;
2908
+ let r = String(t);
2909
+ _.current !== r && (_.current = r, Promise.resolve().then(() => {
2910
+ _.current === r && (_.current = null);
2911
+ }), z({
2909
2912
  value: n.value,
2910
2913
  label: n.label,
2911
2914
  details: n.details,
2912
2915
  icon: n.icon,
2913
2916
  actions: n.actions,
2914
2917
  testId: n.testId
2915
- });
2918
+ }));
2916
2919
  }, [
2917
- E,
2918
- P,
2919
- R,
2920
+ D,
2921
+ F,
2920
2922
  z,
2923
+ B,
2921
2924
  c,
2922
- N
2925
+ P
2923
2926
  ]);
2924
2927
  return {
2925
- getTriggerWidth: j,
2926
- onChangeSearch: T,
2928
+ getTriggerWidth: M,
2929
+ onChangeSearch: E,
2927
2930
  onClickClearAll: u(() => {
2928
- E(), R(c ? [] : { value: null });
2931
+ D(), z(c ? [] : { value: null });
2929
2932
  }, [
2930
- E,
2931
- R,
2933
+ D,
2934
+ z,
2932
2935
  c
2933
2936
  ]),
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,
2937
+ closeLayer: O,
2938
+ handleChange: ee,
2939
+ handleSelectionChange: u((e) => {
2940
+ c || !Pr(e) && String(e) === String(F) && ee(e);
2941
+ }, [
2942
+ c,
2943
+ F,
2944
+ ee
2945
+ ]),
2946
+ getLayerWidth: N,
2947
+ searchValue: C,
2948
+ isOpen: b,
2949
+ setIsOpen: k,
2950
+ visibleOptions: L,
2951
+ comboValue: F,
2952
+ selectedItemId: R,
2943
2953
  comboBoxStateRef: m
2944
2954
  };
2945
2955
  }, Lc = ({ items: e, optionsCount: t, selectedItemId: n, width: r, small: i, isMulti: a = !1, closeLayer: o, testId: s }) => {
@@ -3153,7 +3163,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3153
3163
  children: A
3154
3164
  }) });
3155
3165
  }, 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({
3166
+ 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
3167
  options: o,
3158
3168
  onCreate: l,
3159
3169
  onChange: c,
@@ -3167,27 +3177,28 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3167
3177
  searchable: _
3168
3178
  });
3169
3179
  return h(() => {
3170
- ne && F(ee(N.current));
3171
- }, [ee, ne]), /* @__PURE__ */ w(Mr, {
3180
+ V && F(te(N.current));
3181
+ }, [te, V]), /* @__PURE__ */ w(Mr, {
3172
3182
  "aria-label": u || "Select",
3173
3183
  className: ac.select,
3174
3184
  style: { width: I() },
3175
3185
  isDisabled: M,
3176
3186
  selectionMode: t ? "multiple" : "single",
3177
- value: ie,
3187
+ value: ae,
3178
3188
  onChange: B,
3179
- inputValue: te,
3189
+ onSelectionChange: ee,
3190
+ inputValue: ne,
3180
3191
  onInputChange: _ ? L : void 0,
3181
- items: re,
3192
+ items: ie,
3182
3193
  defaultFilter: Wc,
3183
3194
  allowsEmptyCollection: !0,
3184
3195
  menuTrigger: "manual",
3185
- onOpenChange: V,
3196
+ onOpenChange: re,
3186
3197
  children: [
3187
- /* @__PURE__ */ C(oc, { stateRef: oe }),
3198
+ /* @__PURE__ */ C(oc, { stateRef: se }),
3188
3199
  /* @__PURE__ */ C(Uc, {
3189
3200
  selectedOptions: s,
3190
- searchValue: te,
3201
+ searchValue: ne,
3191
3202
  searchable: _,
3192
3203
  clearable: b,
3193
3204
  error: r,
@@ -3198,7 +3209,7 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3198
3209
  disabled: M,
3199
3210
  onClickClear: R,
3200
3211
  tabIndex: p,
3201
- isOpen: ne,
3212
+ isOpen: V,
3202
3213
  triggerRef: N,
3203
3214
  onFocus: m,
3204
3215
  onBlur: g,
@@ -3215,9 +3226,9 @@ var Io = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Lo =
3215
3226
  triggerRef: N,
3216
3227
  offset: 0,
3217
3228
  children: /* @__PURE__ */ C(Lc, {
3218
- items: re,
3229
+ items: ie,
3219
3230
  optionsCount: o.length,
3220
- selectedItemId: ae,
3231
+ selectedItemId: oe,
3221
3232
  width: P,
3222
3233
  small: f,
3223
3234
  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-43",
3
+ "version": "10.0.0-beta-45",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {