@stackone/malachite 2.45.0 → 2.47.0
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.
- package/COMPONENTS.md +1 -1
- package/dist/components/ActionMenuTagHost.js +11 -11
- package/dist/components/ActionMenuTagHost.js.map +1 -1
- package/dist/components/Dropdown.js +473 -449
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/MultiSelect.js +132 -131
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/Tag.js +8 -8
- package/dist/components/Tag.js.map +1 -1
- package/dist/components/floatingMenuGeometry.js +51 -50
- package/dist/components/floatingMenuGeometry.js.map +1 -1
- package/dist/components/hasBadge.js +5 -0
- package/dist/components/hasBadge.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { jsx as r, jsxs as w, Fragment as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as r, jsxs as w, Fragment as mt } from "react/jsx-runtime";
|
|
2
|
+
import fe, { useId as pt, useState as P, useRef as T, useMemo as H, useCallback as m, useEffect as We, useLayoutEffect as ht, useInsertionEffect as gt } from "react";
|
|
3
3
|
import { createPortal as bt } from "react-dom";
|
|
4
4
|
import vt, { useFormFieldIds as xt } from "./BaseFormComponent.js";
|
|
5
5
|
import yt from "./CustomIcons/CaretDownIcon.js";
|
|
6
6
|
import wt from "./CustomIcons/InfoFilledIcon.js";
|
|
7
7
|
import Et from "./CustomIcons/SearchIcon.js";
|
|
8
|
-
import
|
|
8
|
+
import $e from "./LoadingInput.js";
|
|
9
9
|
import It from "./Spinner.js";
|
|
10
10
|
import { Tag as St } from "./Tag.js";
|
|
11
|
-
import
|
|
11
|
+
import Be from "./Tooltip.js";
|
|
12
12
|
import { getDeepActiveElement as Tt } from "./activeElement.js";
|
|
13
13
|
import { CONTROL_TEXT_SIZE_CLASS as ue, CONTROL_TEXT_SIZE as kt } from "./controlTextSize.js";
|
|
14
14
|
import { controlWidthStyle as Ge } from "./controlWidth.js";
|
|
15
15
|
import { getTriggerVisual as Rt, DROPDOWN_TRIGGER_ATTR as _t } from "./dropdownTriggerStyle.js";
|
|
16
16
|
import { pushEscapeLayer as Lt } from "./escapeLayers.js";
|
|
17
|
-
import { measureMenuGeometry as Ot, MENU_MAX_HEIGHT_PX as Nt, MENU_SPECS as
|
|
17
|
+
import { measureMenuGeometry as Ot, MENU_MAX_HEIGHT_PX as Nt, MENU_SPECS as F } from "./floatingMenuGeometry.js";
|
|
18
18
|
import { FOCUS_RING as Ct, FOCUS_RING_WITHIN_INPUT as At } from "./focusRing.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
19
|
+
import { hasBadge as Dt } from "./hasBadge.js";
|
|
20
|
+
import { ensureMultiSelectPanelStyles as Ht } from "./optionRowStyles.js";
|
|
21
|
+
import { usePopupLayer as Pt } from "./overlayLayers.js";
|
|
22
|
+
import { useTopLayer as Mt } from "./topLayer.js";
|
|
23
|
+
import { tooltipLines as Wt, isCut as $t, isClamped as Bt } from "./truncatedLines.js";
|
|
24
|
+
const Gt = fe.lazy(() => import("./ActionMenuTagHost.js")), Ft = {
|
|
24
25
|
padding: "8px 10px",
|
|
25
26
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
|
|
26
|
-
},
|
|
27
|
+
}, z = {
|
|
27
28
|
small: "h-[var(--malachite-control-height-small,28px)]",
|
|
28
29
|
medium: "h-[var(--malachite-control-height-medium,32px)]",
|
|
29
30
|
large: "h-[var(--malachite-control-height-large,42px)]"
|
|
30
|
-
},
|
|
31
|
-
small: `${
|
|
32
|
-
medium: `${
|
|
33
|
-
large: `${
|
|
34
|
-
},
|
|
31
|
+
}, zt = {
|
|
32
|
+
small: `${z.small} gap-[6px] px-2.5 ${ue.small} rounded-[var(--malachite-radius-10,10px)]`,
|
|
33
|
+
medium: `${z.medium} gap-[8px] px-3 ${ue.medium} rounded-xl`,
|
|
34
|
+
large: `${z.large} gap-[10px] px-4 ${ue.large} rounded-[var(--malachite-radius-xxl,14px)]`
|
|
35
|
+
}, Kt = 10, Ke = "ArrowDown", Ue = "ArrowUp", Ye = "Enter", Ut = "Backspace", Yt = /* @__PURE__ */ new Set([Ke, Ue, Ye]), Ve = fe.forwardRef(
|
|
35
36
|
({ triggerRole: n, disabled: k, children: _, ...u }, g) => n !== "button" ? /* @__PURE__ */ r(
|
|
36
37
|
"div",
|
|
37
38
|
{
|
|
@@ -52,21 +53,21 @@ const Gt = {
|
|
|
52
53
|
}
|
|
53
54
|
)
|
|
54
55
|
);
|
|
55
|
-
|
|
56
|
-
const Fe = 0.6,
|
|
56
|
+
Ve.displayName = "TriggerElement";
|
|
57
|
+
const Fe = 0.6, ze = 420, Vt = ({ option: n }) => {
|
|
57
58
|
const k = T(null), _ = T(null), u = n.description ? n.descriptionMode ?? "icon" : null, g = u === "subtitle", [N, Z] = P({ label: !0, subtitle: !0 }), C = () => {
|
|
58
|
-
const E =
|
|
59
|
+
const E = $t(k.current), p = Bt(_.current);
|
|
59
60
|
return !E && !p && u !== "hover" ? !1 : (Z({ label: E, subtitle: p }), !0);
|
|
60
61
|
}, M = u === "hover" || g && N.subtitle, W = (E) => /* @__PURE__ */ r(
|
|
61
|
-
|
|
62
|
+
Be,
|
|
62
63
|
{
|
|
63
|
-
text:
|
|
64
|
+
text: Wt([
|
|
64
65
|
["label", N.label && n.label],
|
|
65
66
|
["description", M && n.description]
|
|
66
67
|
]),
|
|
67
68
|
shouldShow: C,
|
|
68
69
|
delay: Fe,
|
|
69
|
-
maxWidth:
|
|
70
|
+
maxWidth: ze,
|
|
70
71
|
triggerAs: "span",
|
|
71
72
|
isShrinkable: !0,
|
|
72
73
|
describesTrigger: u === "hover",
|
|
@@ -134,11 +135,11 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
134
135
|
children: [
|
|
135
136
|
W(b),
|
|
136
137
|
u === "icon" && /* @__PURE__ */ r(
|
|
137
|
-
|
|
138
|
+
Be,
|
|
138
139
|
{
|
|
139
140
|
text: n.description,
|
|
140
141
|
delay: Fe,
|
|
141
|
-
maxWidth:
|
|
142
|
+
maxWidth: ze,
|
|
142
143
|
children: /* @__PURE__ */ r(
|
|
143
144
|
"span",
|
|
144
145
|
{
|
|
@@ -156,7 +157,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
156
157
|
]
|
|
157
158
|
}
|
|
158
159
|
);
|
|
159
|
-
},
|
|
160
|
+
}, br = ({
|
|
160
161
|
options: n,
|
|
161
162
|
value: k,
|
|
162
163
|
defaultValue: _,
|
|
@@ -170,54 +171,54 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
170
171
|
disabled: b = !1,
|
|
171
172
|
error: E = !1,
|
|
172
173
|
loading: p = !1,
|
|
173
|
-
label:
|
|
174
|
-
name:
|
|
174
|
+
label: K,
|
|
175
|
+
name: me,
|
|
175
176
|
description: q,
|
|
176
|
-
tooltip:
|
|
177
|
+
tooltip: pe,
|
|
177
178
|
hint: J,
|
|
178
|
-
rightSideContent:
|
|
179
|
+
rightSideContent: he,
|
|
179
180
|
required: Q = !1,
|
|
180
|
-
requiredIndicator:
|
|
181
|
-
formControl:
|
|
181
|
+
requiredIndicator: Xe,
|
|
182
|
+
formControl: ge,
|
|
182
183
|
chips: ee = !1,
|
|
183
184
|
chipsRemovable: te = !0,
|
|
184
|
-
chipsMax:
|
|
185
|
+
chipsMax: be = "auto",
|
|
185
186
|
inlineSearch: v = !1,
|
|
186
187
|
onSearchChange: $,
|
|
187
|
-
localFilter:
|
|
188
|
-
className:
|
|
189
|
-
style:
|
|
190
|
-
id:
|
|
191
|
-
"aria-label":
|
|
192
|
-
"aria-labelledby":
|
|
188
|
+
localFilter: ve = !0,
|
|
189
|
+
className: je = "",
|
|
190
|
+
style: Ze,
|
|
191
|
+
id: qe,
|
|
192
|
+
"aria-label": xe,
|
|
193
|
+
"aria-labelledby": Je
|
|
193
194
|
}) => {
|
|
194
|
-
const
|
|
195
|
-
id:
|
|
196
|
-
label:
|
|
195
|
+
const ye = pt(), we = `${ye}-listbox`, Ee = (e) => `${ye}-option-${e}`, { controlId: Ie, labelId: Se, descriptionId: Qe, hintId: et, describedBy: tt } = xt({
|
|
196
|
+
id: qe,
|
|
197
|
+
label: K,
|
|
197
198
|
description: q,
|
|
198
199
|
hint: J
|
|
199
|
-
}), [
|
|
200
|
-
|
|
201
|
-
const
|
|
200
|
+
}), [rt, nt] = P(() => _ ?? []), re = k !== void 0, f = re ? k : rt, [o, ne] = P(!1), [c, Te] = P(null), [R, at] = P(""), [x, A] = P(-1), U = T(null), B = T(null), L = T(null), ke = T(null);
|
|
201
|
+
Mt(L, o);
|
|
202
|
+
const lt = Pt("multiselect", o, L), Re = T([]), ae = H(() => new Set(f), [f]), s = H(
|
|
202
203
|
() => n.filter((e) => ae.has(e.value)),
|
|
203
204
|
[n, ae]
|
|
204
|
-
), le = typeof
|
|
205
|
-
if (!
|
|
205
|
+
), le = typeof be == "number" ? be : void 0, O = H(() => {
|
|
206
|
+
if (!ve) return n;
|
|
206
207
|
const e = R.trim().toLowerCase();
|
|
207
208
|
return e ? n.filter((t) => (t.searchText ?? (typeof t.label == "string" ? t.label : "")).toLowerCase().includes(e)) : n;
|
|
208
|
-
}, [n, R,
|
|
209
|
+
}, [n, R, ve]), oe = T(!1), _e = T(""), Y = m(
|
|
209
210
|
(e, t) => {
|
|
210
|
-
|
|
211
|
+
_e.current !== e && (_e.current = e, t && (oe.current = !0), at(e), $ == null || $(e));
|
|
211
212
|
},
|
|
212
213
|
[$]
|
|
213
214
|
), se = m(
|
|
214
215
|
(e) => Y(e, !0),
|
|
215
216
|
[Y]
|
|
216
|
-
),
|
|
217
|
-
|
|
217
|
+
), G = m(() => Y("", !1), [Y]);
|
|
218
|
+
We(() => {
|
|
218
219
|
oe.current && (A(-1), oe.current = !1);
|
|
219
220
|
}, [R]);
|
|
220
|
-
const
|
|
221
|
+
const ot = Z ?? ($ !== void 0 || n.length > Kt), Le = v ? !1 : ot, ie = m(() => {
|
|
221
222
|
var e, t;
|
|
222
223
|
ne(!1), (e = L.current) != null && e.contains(Tt()) && ((t = U.current) == null || t.focus());
|
|
223
224
|
}, []), D = m(() => {
|
|
@@ -230,15 +231,15 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
230
231
|
viewportWidth: window.innerWidth,
|
|
231
232
|
viewportHeight: window.innerHeight
|
|
232
233
|
});
|
|
233
|
-
|
|
234
|
+
Te(t);
|
|
234
235
|
}, [W]);
|
|
235
|
-
|
|
236
|
+
We(() => {
|
|
236
237
|
var S;
|
|
237
238
|
if (!o) {
|
|
238
|
-
|
|
239
|
+
G(), A(-1), Te(null);
|
|
239
240
|
return;
|
|
240
241
|
}
|
|
241
|
-
D(), v && ((S =
|
|
242
|
+
D(), v && ((S = B.current) == null || S.focus());
|
|
242
243
|
const e = () => D(), t = (y) => {
|
|
243
244
|
const d = y.composedPath(), a = U.current, i = L.current;
|
|
244
245
|
(!a || !d.includes(a)) && (!i || !d.includes(i)) && ie();
|
|
@@ -246,7 +247,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
246
247
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), document.addEventListener("mousedown", t), () => {
|
|
247
248
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), document.removeEventListener("mousedown", t), l();
|
|
248
249
|
};
|
|
249
|
-
}, [o, D, v,
|
|
250
|
+
}, [o, D, v, G, ie]), ht(() => {
|
|
250
251
|
if (!o)
|
|
251
252
|
return;
|
|
252
253
|
D();
|
|
@@ -258,7 +259,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
258
259
|
}, [o, D]);
|
|
259
260
|
const I = m(
|
|
260
261
|
(e) => {
|
|
261
|
-
re ||
|
|
262
|
+
re || nt(e), u == null || u(e);
|
|
262
263
|
},
|
|
263
264
|
[re, u]
|
|
264
265
|
), V = m(
|
|
@@ -274,21 +275,21 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
274
275
|
for (const t of n)
|
|
275
276
|
t.disabled && e.add(t.value);
|
|
276
277
|
return e;
|
|
277
|
-
}, [n]),
|
|
278
|
+
}, [n]), st = m(
|
|
278
279
|
(e) => {
|
|
279
280
|
e.stopPropagation();
|
|
280
281
|
const t = f.filter((l) => X.has(l));
|
|
281
282
|
I(t);
|
|
282
283
|
},
|
|
283
284
|
[I, f, X]
|
|
284
|
-
),
|
|
285
|
+
), Oe = m(
|
|
285
286
|
(e, t) => {
|
|
286
287
|
t.stopPropagation(), !V(e) && I(f.filter((l) => l !== e));
|
|
287
288
|
},
|
|
288
289
|
[f, I, V]
|
|
289
290
|
), j = m(
|
|
290
291
|
(e) => {
|
|
291
|
-
if (!
|
|
292
|
+
if (!Yt.has(e.key)) return;
|
|
292
293
|
if (e.preventDefault(), e.stopPropagation(), !o) {
|
|
293
294
|
ne(!0);
|
|
294
295
|
return;
|
|
@@ -297,13 +298,13 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
297
298
|
if (t === 0) return;
|
|
298
299
|
const l = (d) => {
|
|
299
300
|
requestAnimationFrame(() => {
|
|
300
|
-
const a =
|
|
301
|
+
const a = Re.current[d], i = ke.current;
|
|
301
302
|
if (!a || !i) return;
|
|
302
|
-
const h = a.offsetTop,
|
|
303
|
-
|
|
304
|
-
top:
|
|
303
|
+
const h = a.offsetTop, Pe = h + a.offsetHeight, Me = i.scrollTop, ft = Me + i.clientHeight;
|
|
304
|
+
Pe > ft ? i.scrollTo({
|
|
305
|
+
top: Pe - i.clientHeight,
|
|
305
306
|
behavior: "smooth"
|
|
306
|
-
}) : h <
|
|
307
|
+
}) : h < Me && i.scrollTo({ top: h, behavior: "smooth" });
|
|
307
308
|
});
|
|
308
309
|
}, S = (d) => {
|
|
309
310
|
var i;
|
|
@@ -317,39 +318,39 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
317
318
|
var i;
|
|
318
319
|
if (x < 0 || x >= t || (i = O[x]) != null && i.disabled) return;
|
|
319
320
|
const d = O[x].value;
|
|
320
|
-
ce(d),
|
|
321
|
+
ce(d), G();
|
|
321
322
|
const a = n.findIndex((h) => h.value === d);
|
|
322
323
|
A(a >= 0 ? a : -1), l(a >= 0 ? a : 0), requestAnimationFrame(() => {
|
|
323
324
|
var h;
|
|
324
|
-
return (h =
|
|
325
|
+
return (h = B.current) == null ? void 0 : h.focus();
|
|
325
326
|
});
|
|
326
327
|
};
|
|
327
328
|
switch (e.key) {
|
|
328
329
|
case Ke:
|
|
329
330
|
S(1);
|
|
330
331
|
break;
|
|
331
|
-
case
|
|
332
|
+
case Ue:
|
|
332
333
|
S(-1);
|
|
333
334
|
break;
|
|
334
|
-
case
|
|
335
|
+
case Ye:
|
|
335
336
|
y();
|
|
336
337
|
break;
|
|
337
338
|
}
|
|
338
339
|
},
|
|
339
|
-
[o, O, x, ce, n,
|
|
340
|
-
),
|
|
340
|
+
[o, O, x, ce, n, G]
|
|
341
|
+
), Ne = m(
|
|
341
342
|
(e) => {
|
|
342
|
-
if (e.key ===
|
|
343
|
+
if (e.key === Ut && R === "" && f.length > 0) {
|
|
343
344
|
e.preventDefault(), I(f.slice(0, -1)), requestAnimationFrame(() => {
|
|
344
345
|
var t;
|
|
345
|
-
return (t =
|
|
346
|
+
return (t = B.current) == null ? void 0 : t.focus();
|
|
346
347
|
});
|
|
347
348
|
return;
|
|
348
349
|
}
|
|
349
350
|
j(e);
|
|
350
351
|
},
|
|
351
352
|
[j, R, f, I]
|
|
352
|
-
),
|
|
353
|
+
), Ce = s.length > 0 && !b && !p, it = Rt({
|
|
353
354
|
disabled: b,
|
|
354
355
|
error: E,
|
|
355
356
|
open: o,
|
|
@@ -358,11 +359,11 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
358
359
|
}), de = H(() => v ? /* @__PURE__ */ r(
|
|
359
360
|
"input",
|
|
360
361
|
{
|
|
361
|
-
ref:
|
|
362
|
+
ref: B,
|
|
362
363
|
type: "text",
|
|
363
364
|
value: R,
|
|
364
365
|
onChange: (e) => se(e.target.value),
|
|
365
|
-
onKeyDown:
|
|
366
|
+
onKeyDown: Ne,
|
|
366
367
|
placeholder: s.length === 0 ? g : "",
|
|
367
368
|
className: "flex-1 w-full min-w-[40px] border-none outline-none bg-transparent text-[length:inherit] p-0 text-[var(--malachite-text-primary,rgb(10,10,10))]",
|
|
368
369
|
onMouseDown: (e) => {
|
|
@@ -373,10 +374,10 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
373
374
|
v,
|
|
374
375
|
R,
|
|
375
376
|
se,
|
|
376
|
-
|
|
377
|
+
Ne,
|
|
377
378
|
s.length,
|
|
378
379
|
g
|
|
379
|
-
]),
|
|
380
|
+
]), ct = H(() => {
|
|
380
381
|
if (N && s.length > 0)
|
|
381
382
|
return N(s);
|
|
382
383
|
if (ee && s.length > 0) {
|
|
@@ -395,7 +396,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
395
396
|
value: l.label,
|
|
396
397
|
type: "default",
|
|
397
398
|
textTransform: "none",
|
|
398
|
-
onRemove: te && !b && !S ? (y) =>
|
|
399
|
+
onRemove: te && !b && !S ? (y) => Oe(l.value, y) : void 0,
|
|
399
400
|
className: "shrink-0"
|
|
400
401
|
},
|
|
401
402
|
l.value
|
|
@@ -418,25 +419,25 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
418
419
|
le,
|
|
419
420
|
te,
|
|
420
421
|
b,
|
|
421
|
-
|
|
422
|
+
Oe,
|
|
422
423
|
v,
|
|
423
424
|
de,
|
|
424
425
|
g,
|
|
425
426
|
X
|
|
426
|
-
]),
|
|
427
|
+
]), dt = n.length === 0 ? "No options available" : "No results found";
|
|
427
428
|
gt(() => {
|
|
428
|
-
o &&
|
|
429
|
+
o && Ht();
|
|
429
430
|
}, [o]);
|
|
430
|
-
const
|
|
431
|
+
const ut = {
|
|
431
432
|
position: "fixed",
|
|
432
433
|
top: (c == null ? void 0 : c.top) ?? 0,
|
|
433
434
|
left: (c == null ? void 0 : c.left) ?? 0,
|
|
434
435
|
width: c == null ? void 0 : c.width,
|
|
435
|
-
background:
|
|
436
|
-
border:
|
|
437
|
-
borderRadius:
|
|
438
|
-
boxShadow:
|
|
439
|
-
padding:
|
|
436
|
+
background: F.standard.background,
|
|
437
|
+
border: F.standard.border,
|
|
438
|
+
borderRadius: F.standard.radius,
|
|
439
|
+
boxShadow: F.standard.shadow,
|
|
440
|
+
padding: F.standard.padding,
|
|
440
441
|
display: "flex",
|
|
441
442
|
flexDirection: "column",
|
|
442
443
|
gap: 4,
|
|
@@ -444,25 +445,25 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
444
445
|
fontSize: kt[C],
|
|
445
446
|
visibility: c ? "visible" : "hidden",
|
|
446
447
|
opacity: c ? 1 : 0
|
|
447
|
-
},
|
|
448
|
+
}, Ae = !!(q || pe || J || he || me || ge || Q), De = Ae && !!K, He = /* @__PURE__ */ w(mt, { children: [
|
|
448
449
|
/* @__PURE__ */ w("div", { className: "relative", style: Ge(M), children: [
|
|
449
450
|
/* @__PURE__ */ w(
|
|
450
|
-
|
|
451
|
+
Ve,
|
|
451
452
|
{
|
|
452
453
|
ref: U,
|
|
453
|
-
id:
|
|
454
|
+
id: Ie,
|
|
454
455
|
triggerRole: v ? "combobox" : ee && te ? "group" : "button",
|
|
455
456
|
disabled: b || p,
|
|
456
457
|
[_t]: "",
|
|
457
458
|
"aria-haspopup": "listbox",
|
|
458
459
|
"aria-expanded": o,
|
|
459
|
-
"aria-controls": o ?
|
|
460
|
-
"aria-activedescendant": v && o && x >= 0 ?
|
|
461
|
-
"aria-labelledby":
|
|
462
|
-
"aria-label":
|
|
460
|
+
"aria-controls": o ? we : void 0,
|
|
461
|
+
"aria-activedescendant": v && o && x >= 0 ? Ee(x) : void 0,
|
|
462
|
+
"aria-labelledby": Je ?? (De && !xe ? Se : void 0),
|
|
463
|
+
"aria-label": xe ?? (De ? void 0 : K),
|
|
463
464
|
"aria-invalid": E || void 0,
|
|
464
465
|
"aria-required": Q || void 0,
|
|
465
|
-
"aria-describedby":
|
|
466
|
+
"aria-describedby": tt,
|
|
466
467
|
"aria-busy": p || void 0,
|
|
467
468
|
onClick: () => {
|
|
468
469
|
b || p || ne((e) => !e);
|
|
@@ -470,16 +471,16 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
470
471
|
onKeyDown: j,
|
|
471
472
|
style: {
|
|
472
473
|
transition: "border-color 0.15s ease, box-shadow 0.15s ease",
|
|
473
|
-
...
|
|
474
|
-
...
|
|
474
|
+
...it,
|
|
475
|
+
...Ze
|
|
475
476
|
},
|
|
476
|
-
className: `w-full ${
|
|
477
|
+
className: `w-full ${zt[C]} border border-solid flex items-center font-normal text-[var(--malachite-text-primary)] ${b || p ? "cursor-not-allowed" : "cursor-pointer"} ${Ct} ${At} ${je}`,
|
|
477
478
|
children: [
|
|
478
479
|
/* @__PURE__ */ r(
|
|
479
480
|
"span",
|
|
480
481
|
{
|
|
481
|
-
className: `flex-1 min-w-0 text-left ${v ? "flex" : "truncate"} ${
|
|
482
|
-
children:
|
|
482
|
+
className: `flex-1 min-w-0 text-left ${v ? "flex" : "truncate"} ${Ce ? "pr-[18px]" : ""}`,
|
|
483
|
+
children: ct
|
|
483
484
|
}
|
|
484
485
|
),
|
|
485
486
|
p ? /* @__PURE__ */ r("span", { className: "flex items-center justify-center shrink-0 size-[14px]", children: /* @__PURE__ */ r(It, { size: "xxxsmall" }) }) : /* @__PURE__ */ r(
|
|
@@ -497,12 +498,12 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
497
498
|
]
|
|
498
499
|
}
|
|
499
500
|
),
|
|
500
|
-
|
|
501
|
+
Ce && /* @__PURE__ */ r(
|
|
501
502
|
"button",
|
|
502
503
|
{
|
|
503
504
|
type: "button",
|
|
504
505
|
"aria-label": "Clear selection",
|
|
505
|
-
onClick:
|
|
506
|
+
onClick: st,
|
|
506
507
|
className: "absolute top-0 bottom-0 right-[28px] flex items-center justify-center px-[2px] leading-none bg-transparent border-none text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer",
|
|
507
508
|
children: "×"
|
|
508
509
|
}
|
|
@@ -513,13 +514,13 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
513
514
|
"div",
|
|
514
515
|
{
|
|
515
516
|
ref: L,
|
|
516
|
-
id:
|
|
517
|
+
id: we,
|
|
517
518
|
role: "listbox",
|
|
518
519
|
"aria-multiselectable": "true",
|
|
519
|
-
...
|
|
520
|
-
style:
|
|
520
|
+
...lt,
|
|
521
|
+
style: ut,
|
|
521
522
|
children: [
|
|
522
|
-
|
|
523
|
+
Le && /* @__PURE__ */ w(
|
|
523
524
|
"div",
|
|
524
525
|
{
|
|
525
526
|
style: {
|
|
@@ -567,7 +568,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
567
568
|
]
|
|
568
569
|
}
|
|
569
570
|
),
|
|
570
|
-
|
|
571
|
+
Le && /* @__PURE__ */ r(
|
|
571
572
|
"div",
|
|
572
573
|
{
|
|
573
574
|
"aria-hidden": "true",
|
|
@@ -582,7 +583,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
582
583
|
/* @__PURE__ */ r(
|
|
583
584
|
"div",
|
|
584
585
|
{
|
|
585
|
-
ref:
|
|
586
|
+
ref: ke,
|
|
586
587
|
style: {
|
|
587
588
|
display: "flex",
|
|
588
589
|
flexDirection: "column",
|
|
@@ -596,15 +597,15 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
596
597
|
},
|
|
597
598
|
children: O.length === 0 ? (
|
|
598
599
|
// `role="listbox"` admits only option/group children.
|
|
599
|
-
/* @__PURE__ */ r("div", { role: "presentation", style:
|
|
600
|
+
/* @__PURE__ */ r("div", { role: "presentation", style: Ft, children: dt })
|
|
600
601
|
) : O.map((e, t) => {
|
|
601
602
|
const l = ae.has(e.value), S = t === x, y = !!e.disabled;
|
|
602
603
|
return /* @__PURE__ */ w(
|
|
603
604
|
"button",
|
|
604
605
|
{
|
|
605
|
-
id:
|
|
606
|
+
id: Ee(t),
|
|
606
607
|
ref: (d) => {
|
|
607
|
-
|
|
608
|
+
Re.current[t] = d;
|
|
608
609
|
},
|
|
609
610
|
type: "button",
|
|
610
611
|
role: "option",
|
|
@@ -612,7 +613,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
612
613
|
"aria-disabled": y || void 0,
|
|
613
614
|
onClick: () => {
|
|
614
615
|
var d;
|
|
615
|
-
ce(e.value),
|
|
616
|
+
ce(e.value), G(), (d = B.current) == null || d.focus();
|
|
616
617
|
},
|
|
617
618
|
onMouseEnter: () => A(t),
|
|
618
619
|
onMouseLeave: () => {
|
|
@@ -638,8 +639,8 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
638
639
|
color: l ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))"
|
|
639
640
|
},
|
|
640
641
|
children: [
|
|
641
|
-
/* @__PURE__ */ r(
|
|
642
|
-
e.badge && /* @__PURE__ */ r(
|
|
642
|
+
/* @__PURE__ */ r(Vt, { option: e }),
|
|
643
|
+
Dt(e.badge) && /* @__PURE__ */ r(
|
|
643
644
|
"span",
|
|
644
645
|
{
|
|
645
646
|
style: {
|
|
@@ -647,7 +648,7 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
647
648
|
flexShrink: 0,
|
|
648
649
|
paddingLeft: 8
|
|
649
650
|
},
|
|
650
|
-
children: e.badge
|
|
651
|
+
children: /* @__PURE__ */ r(fe.Suspense, { fallback: null, children: /* @__PURE__ */ r(Gt, { children: e.badge }) })
|
|
651
652
|
}
|
|
652
653
|
)
|
|
653
654
|
]
|
|
@@ -663,29 +664,29 @@ const Fe = 0.6, Be = 420, Ut = ({ option: n }) => {
|
|
|
663
664
|
document.body
|
|
664
665
|
)
|
|
665
666
|
] });
|
|
666
|
-
return
|
|
667
|
+
return Ae ? /* @__PURE__ */ r(
|
|
667
668
|
vt,
|
|
668
669
|
{
|
|
669
|
-
label:
|
|
670
|
+
label: K,
|
|
670
671
|
hint: J,
|
|
671
|
-
rightSideContent:
|
|
672
|
-
tooltip:
|
|
673
|
-
name:
|
|
672
|
+
rightSideContent: he,
|
|
673
|
+
tooltip: pe,
|
|
674
|
+
name: me ?? "",
|
|
674
675
|
required: Q,
|
|
675
|
-
requiredIndicator:
|
|
676
|
+
requiredIndicator: Xe,
|
|
676
677
|
loading: p,
|
|
677
|
-
formControl:
|
|
678
|
+
formControl: ge,
|
|
678
679
|
description: q,
|
|
679
|
-
controlId:
|
|
680
|
-
labelId:
|
|
681
|
-
descriptionId:
|
|
682
|
-
hintId:
|
|
683
|
-
loadingComponent: M === void 0 ? /* @__PURE__ */ r(
|
|
684
|
-
children:
|
|
680
|
+
controlId: Ie,
|
|
681
|
+
labelId: Se,
|
|
682
|
+
descriptionId: Qe,
|
|
683
|
+
hintId: et,
|
|
684
|
+
loadingComponent: M === void 0 ? /* @__PURE__ */ r($e, { heightClass: z[C] }) : /* @__PURE__ */ r("div", { style: Ge(M), children: /* @__PURE__ */ r($e, { heightClass: z[C] }) }),
|
|
685
|
+
children: He
|
|
685
686
|
}
|
|
686
|
-
) :
|
|
687
|
+
) : He;
|
|
687
688
|
};
|
|
688
689
|
export {
|
|
689
|
-
|
|
690
|
+
br as default
|
|
690
691
|
};
|
|
691
692
|
//# sourceMappingURL=MultiSelect.js.map
|