@memobit/libs 3.26.3 → 3.26.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.
|
@@ -9,7 +9,7 @@ import { useEffect as O, useId as qe, useRef as k, useState as S } from "react";
|
|
|
9
9
|
import { jsx as c, jsxs as v } from "react/jsx-runtime";
|
|
10
10
|
import { createPortal as Ge } from "react-dom";
|
|
11
11
|
import { caretDown as Je, clear as Ne } from "@memobit/icons";
|
|
12
|
-
var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", disabled: N = !1, error:
|
|
12
|
+
var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", disabled: N = !1, error: C, highlighted: Le = !1, id: Oe, label: V, maxVisibleSelectedLabels: Se = 1, multilineChips: ye = !1, multiple: i = !1, name: $, onChange: p, onSearchChange: Ie, options: m, placeholder: F = "Select an option", searchable: f = !0, searchValue: A, selectedCountDisplay: _ = "inline", showChips: H = !1, sortSelectedFirst: ee = !1, success: z, usePortal: L = !0, value: d, valueAsChip: Ee = !0 }) => {
|
|
13
13
|
const [u, x] = S(!1), [s, l] = S(A || ""), [a, ne] = S(m), [y, I] = S(-1), [o, h] = S([]), [R, De] = S({
|
|
14
14
|
top: 0,
|
|
15
15
|
bottom: 0,
|
|
@@ -43,12 +43,12 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
43
43
|
f,
|
|
44
44
|
u
|
|
45
45
|
]);
|
|
46
|
-
const se = k(d),
|
|
46
|
+
const se = k(d), W = k(!1), j = k(null);
|
|
47
47
|
O(() => {
|
|
48
48
|
const n = se.current;
|
|
49
49
|
se.current = d;
|
|
50
|
-
const e = !Object.is(n, d), t = e && !
|
|
51
|
-
if (e && (
|
|
50
|
+
const e = !Object.is(n, d), t = e && !W.current;
|
|
51
|
+
if (e && (W.current = !1), d == null) {
|
|
52
52
|
e && (h([]), t && l(""));
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -100,11 +100,11 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
100
100
|
const t = E.current.getBoundingClientRect(), r = window.visualViewport, g = r?.offsetTop ?? 0, X = g + (r?.height ?? window.innerHeight), he = 300, Y = 8, Z = X - t.bottom, we = t.top - g, me = Z < he && we > Z;
|
|
101
101
|
if (Me(me), L) {
|
|
102
102
|
const _e = Math.max(0, (me ? we : Z) - Y), T = te.current;
|
|
103
|
-
if (T &&
|
|
103
|
+
if (T && j.current === null) {
|
|
104
104
|
const Ue = T.style.width;
|
|
105
|
-
T.style.width = "max-content",
|
|
105
|
+
T.style.width = "max-content", j.current = T.offsetWidth, T.style.width = Ue;
|
|
106
106
|
}
|
|
107
|
-
const ze = 360, ge = document.documentElement.clientWidth, ve = Math.max(t.width, Math.min(
|
|
107
|
+
const ze = 360, ge = document.documentElement.clientWidth, ve = Math.max(t.width, Math.min(j.current ?? t.width, ze, ge - 16));
|
|
108
108
|
De({
|
|
109
109
|
top: t.bottom,
|
|
110
110
|
bottom: window.innerHeight - t.top,
|
|
@@ -117,7 +117,7 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
117
117
|
n();
|
|
118
118
|
const e = window.visualViewport;
|
|
119
119
|
return window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), e?.addEventListener("resize", n), e?.addEventListener("scroll", n), () => {
|
|
120
|
-
|
|
120
|
+
j.current = null, window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n), e?.removeEventListener("resize", n), e?.removeEventListener("scroll", n);
|
|
121
121
|
};
|
|
122
122
|
}, [u, L]), O(() => {
|
|
123
123
|
const n = (e) => {
|
|
@@ -158,7 +158,7 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
158
158
|
if (i) {
|
|
159
159
|
const e = o.some((r) => r.value === n.value);
|
|
160
160
|
let t;
|
|
161
|
-
e ?
|
|
161
|
+
e ? t = o.filter((r) => r.value !== n.value) : t = [...o, n], e || !H ? W.current = !0 : f && l(""), h(t), p && p(t, $);
|
|
162
162
|
} else
|
|
163
163
|
l(n.label), h([n]), x(!1), p && p(n, $);
|
|
164
164
|
}, G = () => {
|
|
@@ -180,7 +180,7 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
180
180
|
h([e]), l(e.label), x(!1), p && p(e, $);
|
|
181
181
|
}, ce = (n) => {
|
|
182
182
|
const e = o.filter((t) => t.value !== n.value);
|
|
183
|
-
h(e), p && (i ? (
|
|
183
|
+
h(e), p && (i ? (W.current = !0, p(e, $)) : (p(null, $), f || l("")));
|
|
184
184
|
}, Re = () => {
|
|
185
185
|
h([]), (!f || !i) && l(""), x(!1), p && p(i ? [] : null, $);
|
|
186
186
|
}, Be = (n) => {
|
|
@@ -220,13 +220,13 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
220
220
|
i && s === "" && o.length > 0 && (n.preventDefault(), ce(o[o.length - 1]));
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
}, J = (n) => o.some((e) => e.value === n.value),
|
|
223
|
+
}, J = (n) => o.some((e) => e.value === n.value), He = () => {
|
|
224
224
|
if (o.length === 0) return "";
|
|
225
225
|
const n = Math.max(1, Se);
|
|
226
226
|
if (o.length <= n) return o.map((r) => r.label).join(", ");
|
|
227
227
|
const e = o.slice(0, n).map((r) => r.label).join(", "), t = o.length - n;
|
|
228
228
|
return `${e} (+${t} ${t === 1 ? "other" : "others"})`;
|
|
229
|
-
},
|
|
229
|
+
}, We = () => i && H || f && u ? s : o.length > 0 ? i ? He() : o[0].label : "", je = () => i && H ? o.length > 0 ? "" : F : u && f ? F : o.length > 0 ? "" : F, Ce = () => !i || o.length === 0 || _ === "none" ? null : _ === "floating" ? /* @__PURE__ */ v("div", {
|
|
230
230
|
className: "dropdown-selected-count",
|
|
231
231
|
children: [o.length, " selected"]
|
|
232
232
|
}) : null, le = () => !!(w && s && s.trim() && !a.some((n) => n.label.toLowerCase() === s.toLowerCase() || n.value.toString() === s)), Fe = () => {
|
|
@@ -321,9 +321,9 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
321
321
|
})
|
|
322
322
|
});
|
|
323
323
|
return L ? Ge(n, document.body) : n;
|
|
324
|
-
}, b = !i && o.length === 1 ? o[0] : null, B = Ee && !u && !i && o.length > 0, ae = !!(b?.icon && !s && !B), fe = !!(b?.suffixIcon && !B), Q = i &&
|
|
324
|
+
}, b = !i && o.length === 1 ? o[0] : null, B = Ee && !u && !i && o.length > 0, ae = !!(b?.icon && !s && !B), fe = !!(b?.suffixIcon && !B), Q = i && H, ue = o.length > 0, pe = f || w;
|
|
325
325
|
return /* @__PURE__ */ v("div", {
|
|
326
|
-
className: `dropdown-container ${
|
|
326
|
+
className: `dropdown-container ${C ? "dropdown-error" : ""} ${z ? "dropdown-success" : ""} ${Le ? "dropdown-highlighted" : ""} ${i ? "multiple" : ""} ${N ? "disabled" : ""} ${i ? `count-display-${_}` : ""} ${ke}`,
|
|
327
327
|
ref: E,
|
|
328
328
|
children: [
|
|
329
329
|
V && /* @__PURE__ */ c("label", {
|
|
@@ -367,8 +367,8 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
367
367
|
/* @__PURE__ */ c(Pe, {
|
|
368
368
|
ref: K,
|
|
369
369
|
id: oe,
|
|
370
|
-
placeholder: B ? "" :
|
|
371
|
-
value: B ? "" :
|
|
370
|
+
placeholder: B ? "" : je(),
|
|
371
|
+
value: B ? "" : We(),
|
|
372
372
|
onChange: pe ? Be : void 0,
|
|
373
373
|
onClick: de,
|
|
374
374
|
onKeyDown: Ae,
|
|
@@ -404,13 +404,13 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
|
|
|
404
404
|
})
|
|
405
405
|
]
|
|
406
406
|
}),
|
|
407
|
-
|
|
407
|
+
Ce()
|
|
408
408
|
]
|
|
409
409
|
}),
|
|
410
410
|
Fe(),
|
|
411
|
-
|
|
411
|
+
C && /* @__PURE__ */ c("span", {
|
|
412
412
|
className: "dropdown-error-message",
|
|
413
|
-
children:
|
|
413
|
+
children: C
|
|
414
414
|
}),
|
|
415
415
|
z && /* @__PURE__ */ c("span", {
|
|
416
416
|
className: "dropdown-success-message",
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var I = "3.26.
|
|
1
|
+
var I = "3.26.4", B = 622, L = "a6066ce", _ = "2026-10-30T15:01:01.766Z", a = "622";
|
|
2
2
|
export {
|
|
3
3
|
_ as LIB_BUILD_DATE,
|
|
4
|
-
|
|
4
|
+
a as LIB_BUILD_ID,
|
|
5
5
|
B as LIB_BUILD_NUMBER,
|
|
6
6
|
L as LIB_COMMIT,
|
|
7
7
|
I as LIB_VERSION
|
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.26.
|
|
3
|
+
"version": "3.26.4",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|