@stackone/malachite 2.134.2 → 2.135.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/dist/components/MultiSelect.js +414 -353
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,50 +1,74 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { FieldMessage as
|
|
9
|
-
import { FormItem as
|
|
10
|
-
import
|
|
11
|
-
import { Spinner as
|
|
12
|
-
import { Tag as
|
|
13
|
-
import
|
|
14
|
-
import { getDeepActiveNode as
|
|
15
|
-
import { CONTROL_TEXT_SIZE_CLASS as
|
|
16
|
-
import { controlWidthStyle as
|
|
17
|
-
import { getTriggerVisual as
|
|
18
|
-
import { pushEscapeLayer as
|
|
19
|
-
import { measureMenuGeometry as
|
|
20
|
-
import { FOCUS_RING as
|
|
21
|
-
import { hasBadge as
|
|
22
|
-
import { ensureMultiSelectPanelStyles as
|
|
23
|
-
import { usePopupLayer as
|
|
24
|
-
import { useTopLayer as
|
|
25
|
-
import { tooltipLines as
|
|
26
|
-
import { useFollowTrigger as
|
|
27
|
-
import { useLatestRef as
|
|
28
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as g, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
+
import we, { useId as tt, useState as Y, useRef as _, useMemo as U, useCallback as h, useEffect as Ve, useLayoutEffect as Ot, useInsertionEffect as Nt } from "react";
|
|
3
|
+
import { createPortal as Rt } from "react-dom";
|
|
4
|
+
import Mt, { useFormFieldIds as Ct } from "./BaseFormComponent.js";
|
|
5
|
+
import Dt from "./CustomIcons/CaretDownIcon.js";
|
|
6
|
+
import At from "./CustomIcons/InfoFilledIcon.js";
|
|
7
|
+
import Ht from "./CustomIcons/SearchIcon.js";
|
|
8
|
+
import { FieldMessage as Pt } from "./FieldMessage.js";
|
|
9
|
+
import { FormItem as Wt } from "./FormItem.js";
|
|
10
|
+
import je from "./LoadingInput.js";
|
|
11
|
+
import { Spinner as $t } from "./Spinner.js";
|
|
12
|
+
import { Tag as Bt } from "./Tag.js";
|
|
13
|
+
import Xe from "./Tooltip.js";
|
|
14
|
+
import { getDeepActiveNode as qe } from "./activeElement.js";
|
|
15
|
+
import { CONTROL_TEXT_SIZE_CLASS as ve, CONTROL_TEXT_SIZE as Yt } from "./controlTextSize.js";
|
|
16
|
+
import { controlWidthStyle as Ze } from "./controlWidth.js";
|
|
17
|
+
import { getTriggerVisual as Gt, DROPDOWN_TRIGGER_ATTR as Ut } from "./dropdownTriggerStyle.js";
|
|
18
|
+
import { pushEscapeLayer as zt } from "./escapeLayers.js";
|
|
19
|
+
import { measureMenuGeometry as Kt, MENU_MAX_HEIGHT_PX as Ft, MENU_SPECS as q } from "./floatingMenuGeometry.js";
|
|
20
|
+
import { FOCUS_RING as Vt } from "./focusRing.js";
|
|
21
|
+
import { hasBadge as jt } from "./hasBadge.js";
|
|
22
|
+
import { ensureMultiSelectPanelStyles as Xt } from "./optionRowStyles.js";
|
|
23
|
+
import { usePopupLayer as qt } from "./overlayLayers.js";
|
|
24
|
+
import { useTopLayer as Zt } from "./topLayer.js";
|
|
25
|
+
import { tooltipLines as Jt, isCut as Qt, isClamped as er } from "./truncatedLines.js";
|
|
26
|
+
import { useFollowTrigger as tr } from "./useFollowTrigger.js";
|
|
27
|
+
import { useLatestRef as rr } from "./useLatestRef.js";
|
|
28
|
+
const nr = we.lazy(() => import("./ActionMenuTagHost.js")), or = {
|
|
29
29
|
padding: "8px 10px",
|
|
30
30
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
|
|
31
|
-
},
|
|
31
|
+
}, Je = {
|
|
32
|
+
height: 1,
|
|
33
|
+
width: "100%",
|
|
34
|
+
background: "var(--malachite-card-border, rgb(232, 232, 232))",
|
|
35
|
+
flexShrink: 0
|
|
36
|
+
}, lr = {
|
|
37
|
+
display: "flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
gap: 8,
|
|
40
|
+
width: "100%",
|
|
41
|
+
flexShrink: 0,
|
|
42
|
+
border: "none",
|
|
43
|
+
textAlign: "left",
|
|
44
|
+
borderRadius: "var(--malachite-radius-lg, 8px)",
|
|
45
|
+
padding: "8px 10px",
|
|
46
|
+
font: "inherit",
|
|
47
|
+
cursor: "pointer",
|
|
48
|
+
color: "var(--malachite-accent-foreground, rgb(2, 122, 66))"
|
|
49
|
+
}, ar = {
|
|
50
|
+
flex: 1,
|
|
51
|
+
minWidth: 0,
|
|
52
|
+
overflow: "hidden",
|
|
53
|
+
textOverflow: "ellipsis",
|
|
54
|
+
whiteSpace: "nowrap"
|
|
55
|
+
}, sr = { display: "flex", flexShrink: 0 }, Z = {
|
|
32
56
|
small: "h-[var(--malachite-control-height-small,28px)]",
|
|
33
57
|
medium: "h-[var(--malachite-control-height-medium,32px)]",
|
|
34
58
|
large: "h-[var(--malachite-control-height-large,42px)]"
|
|
35
|
-
},
|
|
36
|
-
small: `${
|
|
37
|
-
medium: `${
|
|
38
|
-
large: `${
|
|
39
|
-
},
|
|
40
|
-
({ triggerRole: n, disabled: y, children:
|
|
59
|
+
}, ir = {
|
|
60
|
+
small: `${Z.small} gap-[6px] px-2.5 ${ve.small} rounded-[var(--malachite-radius-10,10px)]`,
|
|
61
|
+
medium: `${Z.medium} gap-[8px] px-3 ${ve.medium} rounded-xl`,
|
|
62
|
+
large: `${Z.large} gap-[10px] px-4 ${ve.large} rounded-[var(--malachite-radius-xxl,14px)]`
|
|
63
|
+
}, cr = 10, rt = "ArrowDown", nt = "ArrowUp", ot = "Enter", dr = "Backspace", ur = /* @__PURE__ */ new Set([rt, nt, ot]), lt = we.forwardRef(
|
|
64
|
+
({ triggerRole: n, disabled: y, children: I, ...s }, b) => n !== "button" ? /* @__PURE__ */ r(
|
|
41
65
|
"div",
|
|
42
66
|
{
|
|
43
67
|
ref: b,
|
|
44
68
|
role: n,
|
|
45
69
|
tabIndex: y ? -1 : 0,
|
|
46
70
|
...s,
|
|
47
|
-
children:
|
|
71
|
+
children: I
|
|
48
72
|
}
|
|
49
73
|
) : /* @__PURE__ */ r(
|
|
50
74
|
"button",
|
|
@@ -53,29 +77,29 @@ const qt = pe.lazy(() => import("./ActionMenuTagHost.js")), Zt = {
|
|
|
53
77
|
type: "button",
|
|
54
78
|
disabled: y,
|
|
55
79
|
...s,
|
|
56
|
-
children:
|
|
80
|
+
children: I
|
|
57
81
|
}
|
|
58
82
|
)
|
|
59
83
|
);
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
const y =
|
|
63
|
-
const
|
|
64
|
-
return !
|
|
65
|
-
},
|
|
66
|
-
|
|
84
|
+
lt.displayName = "TriggerElement";
|
|
85
|
+
const Qe = 0.2, et = 420, fr = ({ option: n }) => {
|
|
86
|
+
const y = _(null), I = _(null), s = n.description ? n.descriptionMode ?? "icon" : null, b = s === "subtitle", [k, z] = Y({ label: !0, subtitle: !0 }), M = () => {
|
|
87
|
+
const x = Qt(y.current), i = er(I.current);
|
|
88
|
+
return !x && !i && s !== "hover" ? !1 : (z({ label: x, subtitle: i }), !0);
|
|
89
|
+
}, L = s === "hover" || b && k.subtitle, H = (x) => /* @__PURE__ */ r(
|
|
90
|
+
Xe,
|
|
67
91
|
{
|
|
68
|
-
text:
|
|
69
|
-
["label",
|
|
70
|
-
["description",
|
|
92
|
+
text: Jt([
|
|
93
|
+
["label", k.label && n.label],
|
|
94
|
+
["description", L && n.description]
|
|
71
95
|
]),
|
|
72
|
-
shouldShow:
|
|
73
|
-
delay:
|
|
74
|
-
maxWidth:
|
|
96
|
+
shouldShow: M,
|
|
97
|
+
delay: Qe,
|
|
98
|
+
maxWidth: et,
|
|
75
99
|
triggerAs: "span",
|
|
76
100
|
isShrinkable: !0,
|
|
77
101
|
describesTrigger: s === "hover",
|
|
78
|
-
children:
|
|
102
|
+
children: x
|
|
79
103
|
}
|
|
80
104
|
), d = /* @__PURE__ */ r(
|
|
81
105
|
"span",
|
|
@@ -90,8 +114,8 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
90
114
|
children: n.label
|
|
91
115
|
}
|
|
92
116
|
);
|
|
93
|
-
return b ?
|
|
94
|
-
/* @__PURE__ */
|
|
117
|
+
return b ? H(
|
|
118
|
+
/* @__PURE__ */ g(
|
|
95
119
|
"span",
|
|
96
120
|
{
|
|
97
121
|
style: {
|
|
@@ -107,7 +131,7 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
107
131
|
/* @__PURE__ */ r(
|
|
108
132
|
"span",
|
|
109
133
|
{
|
|
110
|
-
ref:
|
|
134
|
+
ref: I,
|
|
111
135
|
style: {
|
|
112
136
|
fontSize: 12,
|
|
113
137
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
@@ -126,7 +150,7 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
126
150
|
]
|
|
127
151
|
}
|
|
128
152
|
)
|
|
129
|
-
) : /* @__PURE__ */
|
|
153
|
+
) : /* @__PURE__ */ g(
|
|
130
154
|
"span",
|
|
131
155
|
{
|
|
132
156
|
style: {
|
|
@@ -137,13 +161,13 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
137
161
|
gap: 6
|
|
138
162
|
},
|
|
139
163
|
children: [
|
|
140
|
-
|
|
164
|
+
H(d),
|
|
141
165
|
s === "icon" && /* @__PURE__ */ r(
|
|
142
|
-
|
|
166
|
+
Xe,
|
|
143
167
|
{
|
|
144
168
|
text: n.description,
|
|
145
|
-
delay:
|
|
146
|
-
maxWidth:
|
|
169
|
+
delay: Qe,
|
|
170
|
+
maxWidth: et,
|
|
147
171
|
children: /* @__PURE__ */ r(
|
|
148
172
|
"span",
|
|
149
173
|
{
|
|
@@ -152,8 +176,8 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
152
176
|
color: "var(--malachite-text-placeholder, rgb(187, 187, 187))"
|
|
153
177
|
},
|
|
154
178
|
"aria-label": "More information",
|
|
155
|
-
onClick: (
|
|
156
|
-
children: n.descriptionIcon ?? /* @__PURE__ */ r(
|
|
179
|
+
onClick: (x) => x.stopPropagation(),
|
|
180
|
+
children: n.descriptionIcon ?? /* @__PURE__ */ r(At, { size: 14 })
|
|
157
181
|
}
|
|
158
182
|
)
|
|
159
183
|
}
|
|
@@ -161,216 +185,238 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
161
185
|
]
|
|
162
186
|
}
|
|
163
187
|
);
|
|
164
|
-
},
|
|
188
|
+
}, at = ({
|
|
165
189
|
options: n,
|
|
166
190
|
value: y,
|
|
167
|
-
defaultValue:
|
|
191
|
+
defaultValue: I,
|
|
168
192
|
onChange: s,
|
|
169
193
|
placeholder: b = "Select",
|
|
170
|
-
renderTrigger:
|
|
171
|
-
searchable:
|
|
172
|
-
size:
|
|
173
|
-
width:
|
|
174
|
-
minWidth:
|
|
194
|
+
renderTrigger: k,
|
|
195
|
+
searchable: z,
|
|
196
|
+
size: M = "large",
|
|
197
|
+
width: L = "auto",
|
|
198
|
+
minWidth: H,
|
|
175
199
|
disabled: d = !1,
|
|
176
|
-
error:
|
|
200
|
+
error: x = !1,
|
|
177
201
|
loading: i = !1,
|
|
178
|
-
label:
|
|
179
|
-
name:
|
|
180
|
-
description:
|
|
181
|
-
tooltip:
|
|
182
|
-
hint:
|
|
183
|
-
hintIcon:
|
|
184
|
-
rightSideContent:
|
|
185
|
-
required:
|
|
186
|
-
requiredIndicator:
|
|
187
|
-
formControl:
|
|
188
|
-
chips:
|
|
189
|
-
chipsRemovable:
|
|
190
|
-
chipsMax:
|
|
191
|
-
inlineSearch:
|
|
192
|
-
onSearchChange:
|
|
193
|
-
localFilter:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"aria-
|
|
199
|
-
|
|
200
|
-
|
|
202
|
+
label: J,
|
|
203
|
+
name: Ee,
|
|
204
|
+
description: ne,
|
|
205
|
+
tooltip: Ie,
|
|
206
|
+
hint: oe,
|
|
207
|
+
hintIcon: st,
|
|
208
|
+
rightSideContent: Se,
|
|
209
|
+
required: le = !1,
|
|
210
|
+
requiredIndicator: it,
|
|
211
|
+
formControl: Te,
|
|
212
|
+
chips: ae = !1,
|
|
213
|
+
chipsRemovable: se = !0,
|
|
214
|
+
chipsMax: _e = "auto",
|
|
215
|
+
inlineSearch: w = !1,
|
|
216
|
+
onSearchChange: K,
|
|
217
|
+
localFilter: ke = !0,
|
|
218
|
+
menuAction: S,
|
|
219
|
+
className: ct = "",
|
|
220
|
+
style: dt,
|
|
221
|
+
id: ut,
|
|
222
|
+
"aria-label": Le,
|
|
223
|
+
"aria-labelledby": ft,
|
|
224
|
+
errorMessageId: pt,
|
|
225
|
+
onFieldLeave: mt
|
|
201
226
|
}) => {
|
|
202
|
-
const
|
|
203
|
-
id:
|
|
204
|
-
label:
|
|
205
|
-
description:
|
|
206
|
-
hint:
|
|
207
|
-
}), [
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
() => n.filter((e) =>
|
|
211
|
-
[n,
|
|
212
|
-
),
|
|
213
|
-
if (!
|
|
214
|
-
const e =
|
|
227
|
+
const ie = tt(), Oe = `${ie}-listbox`, Ne = (e) => `${ie}-option-${e}`, Re = `${ie}-menu-action`, { controlId: Me, labelId: Ce, descriptionId: ht, hintId: gt, describedBy: bt } = Ct({
|
|
228
|
+
id: ut,
|
|
229
|
+
label: J,
|
|
230
|
+
description: ne,
|
|
231
|
+
hint: oe
|
|
232
|
+
}), [xt, vt] = Y(() => I ?? []), ce = y !== void 0, m = ce ? y : xt, [a, de] = Y(!1), [f, De] = Y(null), [C, yt] = Y(""), [T, D] = Y(-1), [F, P] = Y(!1), V = _(null), ue = _(null), W = rr(mt), j = _(null), A = _(null), Ae = _(null);
|
|
233
|
+
Zt(A, a);
|
|
234
|
+
const wt = qt("multiselect", a, A), He = _([]), fe = U(() => new Set(m), [m]), c = U(
|
|
235
|
+
() => n.filter((e) => fe.has(e.value)),
|
|
236
|
+
[n, fe]
|
|
237
|
+
), pe = typeof _e == "number" ? _e : void 0, $ = U(() => {
|
|
238
|
+
if (!ke) return n;
|
|
239
|
+
const e = C.trim().toLowerCase();
|
|
215
240
|
return e ? n.filter((t) => (t.searchText ?? (typeof t.label == "string" ? t.label : "")).toLowerCase().includes(e)) : n;
|
|
216
|
-
}, [n,
|
|
241
|
+
}, [n, C, ke]), me = _(!1), Pe = _(""), Q = h(
|
|
217
242
|
(e, t) => {
|
|
218
|
-
|
|
243
|
+
Pe.current !== e && (Pe.current = e, t && (me.current = !0), yt(e), K == null || K(e));
|
|
219
244
|
},
|
|
220
|
-
[
|
|
221
|
-
),
|
|
222
|
-
(e) =>
|
|
223
|
-
[
|
|
224
|
-
),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, [
|
|
228
|
-
const
|
|
245
|
+
[K]
|
|
246
|
+
), he = h(
|
|
247
|
+
(e) => Q(e, !0),
|
|
248
|
+
[Q]
|
|
249
|
+
), X = h(() => Q("", !1), [Q]);
|
|
250
|
+
Ve(() => {
|
|
251
|
+
me.current && (D(-1), P(!1), me.current = !1);
|
|
252
|
+
}, [C]);
|
|
253
|
+
const Et = z ?? (K !== void 0 || n.length > cr), We = w ? !1 : Et, G = h(() => {
|
|
229
254
|
var e, t, o, u;
|
|
230
|
-
|
|
231
|
-
}, [
|
|
232
|
-
const e =
|
|
255
|
+
de(!1), (e = A.current) != null && e.contains(qe()) && ((t = V.current) == null || t.focus({ preventScroll: !0 })), (o = ue.current) != null && o.contains(qe()) || (u = W.current) == null || u.call(W);
|
|
256
|
+
}, [W]), B = h(() => {
|
|
257
|
+
const e = V.current;
|
|
233
258
|
if (!e) return;
|
|
234
|
-
const t =
|
|
259
|
+
const t = Kt(A.current, {
|
|
235
260
|
triggerRect: e.getBoundingClientRect(),
|
|
236
261
|
preset: "standard",
|
|
237
|
-
minWidth:
|
|
262
|
+
minWidth: H,
|
|
238
263
|
viewportWidth: window.innerWidth,
|
|
239
264
|
viewportHeight: window.innerHeight
|
|
240
265
|
});
|
|
241
|
-
|
|
242
|
-
}, [
|
|
243
|
-
|
|
266
|
+
De(t);
|
|
267
|
+
}, [H]);
|
|
268
|
+
tr(a, V, B, G), Ve(() => {
|
|
244
269
|
var u;
|
|
245
|
-
if (!
|
|
246
|
-
|
|
270
|
+
if (!a) {
|
|
271
|
+
X(), D(-1), P(!1), De(null);
|
|
247
272
|
return;
|
|
248
273
|
}
|
|
249
|
-
|
|
250
|
-
const e = () =>
|
|
251
|
-
const
|
|
252
|
-
(!
|
|
253
|
-
}, o =
|
|
274
|
+
B(), w && ((u = j.current) == null || u.focus());
|
|
275
|
+
const e = () => B(), t = (p) => {
|
|
276
|
+
const N = p.composedPath(), R = V.current, l = A.current;
|
|
277
|
+
(!R || !N.includes(R)) && (!l || !N.includes(l)) && G();
|
|
278
|
+
}, o = zt(G);
|
|
254
279
|
return window.addEventListener("resize", e), document.addEventListener("mousedown", t), () => {
|
|
255
280
|
window.removeEventListener("resize", e), document.removeEventListener("mousedown", t), o();
|
|
256
281
|
};
|
|
257
|
-
}, [
|
|
258
|
-
if (!
|
|
282
|
+
}, [a, B, w, X, G]), Ot(() => {
|
|
283
|
+
if (!a)
|
|
259
284
|
return;
|
|
260
|
-
|
|
285
|
+
B();
|
|
261
286
|
const e = A.current;
|
|
262
287
|
if (!e || typeof ResizeObserver > "u")
|
|
263
288
|
return;
|
|
264
|
-
const t = new ResizeObserver(() =>
|
|
289
|
+
const t = new ResizeObserver(() => B());
|
|
265
290
|
return t.observe(e), () => t.disconnect();
|
|
266
|
-
}, [
|
|
267
|
-
const
|
|
291
|
+
}, [a, B]);
|
|
292
|
+
const ge = h(() => {
|
|
293
|
+
G(), S == null || S.onSelect();
|
|
294
|
+
}, [G, S]), O = h(
|
|
268
295
|
(e) => {
|
|
269
|
-
|
|
296
|
+
ce || vt(e), s == null || s(e);
|
|
270
297
|
},
|
|
271
|
-
[
|
|
272
|
-
),
|
|
298
|
+
[ce, s]
|
|
299
|
+
), ee = h(
|
|
273
300
|
(e) => n.some((t) => t.value === e && t.disabled),
|
|
274
301
|
[n]
|
|
275
|
-
),
|
|
302
|
+
), be = h(
|
|
276
303
|
(e) => {
|
|
277
|
-
|
|
304
|
+
ee(e) || (m.includes(e) ? O(m.filter((t) => t !== e)) : O([...m, e]));
|
|
278
305
|
},
|
|
279
|
-
[
|
|
280
|
-
),
|
|
306
|
+
[m, O, ee]
|
|
307
|
+
), te = U(() => {
|
|
281
308
|
const e = /* @__PURE__ */ new Set();
|
|
282
309
|
for (const t of n)
|
|
283
310
|
t.disabled && e.add(t.value);
|
|
284
311
|
return e;
|
|
285
|
-
}, [n]),
|
|
312
|
+
}, [n]), It = h(
|
|
286
313
|
(e) => {
|
|
287
314
|
e.stopPropagation();
|
|
288
|
-
const t =
|
|
289
|
-
|
|
315
|
+
const t = m.filter((o) => te.has(o));
|
|
316
|
+
O(t);
|
|
290
317
|
},
|
|
291
|
-
[
|
|
292
|
-
),
|
|
318
|
+
[O, m, te]
|
|
319
|
+
), $e = h(
|
|
293
320
|
(e, t) => {
|
|
294
|
-
t.stopPropagation(), !
|
|
321
|
+
t.stopPropagation(), !ee(e) && O(m.filter((o) => o !== e));
|
|
295
322
|
},
|
|
296
|
-
[
|
|
297
|
-
),
|
|
323
|
+
[m, O, ee]
|
|
324
|
+
), re = h(
|
|
298
325
|
(e) => {
|
|
299
|
-
if (!
|
|
300
|
-
if (e.preventDefault(), e.stopPropagation(), !
|
|
301
|
-
|
|
326
|
+
if (!ur.has(e.key)) return;
|
|
327
|
+
if (e.preventDefault(), e.stopPropagation(), !a) {
|
|
328
|
+
de(!0);
|
|
302
329
|
return;
|
|
303
330
|
}
|
|
304
|
-
const t =
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
331
|
+
const t = $.length, o = t + (S ? 1 : 0);
|
|
332
|
+
if (o === 0) return;
|
|
333
|
+
const u = (R) => {
|
|
307
334
|
requestAnimationFrame(() => {
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
top:
|
|
335
|
+
const l = He.current[R], v = Ae.current;
|
|
336
|
+
if (!l || !v) return;
|
|
337
|
+
const E = l.offsetTop, Ke = E + l.offsetHeight, Fe = v.scrollTop, Lt = Fe + v.clientHeight;
|
|
338
|
+
Ke > Lt ? v.scrollTo({
|
|
339
|
+
top: Ke - v.clientHeight,
|
|
313
340
|
behavior: "smooth"
|
|
314
|
-
}) :
|
|
341
|
+
}) : E < Fe && v.scrollTo({ top: E, behavior: "smooth" });
|
|
315
342
|
});
|
|
316
|
-
},
|
|
317
|
-
var
|
|
318
|
-
let
|
|
319
|
-
for (let
|
|
320
|
-
if (
|
|
321
|
-
|
|
343
|
+
}, p = (R) => {
|
|
344
|
+
var v;
|
|
345
|
+
let l = F ? t : T;
|
|
346
|
+
for (let E = 0; E < o; E++) {
|
|
347
|
+
if (l = R === 1 ? l < o - 1 ? l + 1 : 0 : l > 0 ? l - 1 : o - 1, l === t) {
|
|
348
|
+
D(-1), P(!0);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (!((v = $[l]) != null && v.disabled)) {
|
|
352
|
+
u(l), P(!1), D(l);
|
|
322
353
|
return;
|
|
323
354
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
355
|
+
}
|
|
356
|
+
}, N = () => {
|
|
357
|
+
var v;
|
|
358
|
+
if (F) {
|
|
359
|
+
ge();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (T < 0 || T >= t || (v = $[T]) != null && v.disabled) return;
|
|
363
|
+
const R = $[T].value;
|
|
364
|
+
be(R), X();
|
|
365
|
+
const l = n.findIndex((E) => E.value === R);
|
|
366
|
+
D(l >= 0 ? l : -1), u(l >= 0 ? l : 0), requestAnimationFrame(() => {
|
|
367
|
+
var E;
|
|
368
|
+
return (E = j.current) == null ? void 0 : E.focus();
|
|
333
369
|
});
|
|
334
370
|
};
|
|
335
371
|
switch (e.key) {
|
|
336
|
-
case
|
|
337
|
-
|
|
372
|
+
case rt:
|
|
373
|
+
p(1);
|
|
338
374
|
break;
|
|
339
|
-
case
|
|
340
|
-
|
|
375
|
+
case nt:
|
|
376
|
+
p(-1);
|
|
341
377
|
break;
|
|
342
|
-
case
|
|
343
|
-
|
|
378
|
+
case ot:
|
|
379
|
+
N();
|
|
344
380
|
break;
|
|
345
381
|
}
|
|
346
382
|
},
|
|
347
|
-
[
|
|
348
|
-
|
|
383
|
+
[
|
|
384
|
+
a,
|
|
385
|
+
$,
|
|
386
|
+
T,
|
|
387
|
+
be,
|
|
388
|
+
n,
|
|
389
|
+
X,
|
|
390
|
+
S,
|
|
391
|
+
F,
|
|
392
|
+
ge
|
|
393
|
+
]
|
|
394
|
+
), Be = h(
|
|
349
395
|
(e) => {
|
|
350
|
-
if (e.key ===
|
|
351
|
-
e.preventDefault(),
|
|
396
|
+
if (e.key === dr && C === "" && m.length > 0) {
|
|
397
|
+
e.preventDefault(), O(m.slice(0, -1)), requestAnimationFrame(() => {
|
|
352
398
|
var t;
|
|
353
|
-
return (t =
|
|
399
|
+
return (t = j.current) == null ? void 0 : t.focus();
|
|
354
400
|
});
|
|
355
401
|
return;
|
|
356
402
|
}
|
|
357
|
-
|
|
403
|
+
re(e);
|
|
358
404
|
},
|
|
359
|
-
[
|
|
360
|
-
),
|
|
405
|
+
[re, C, m, O]
|
|
406
|
+
), Ye = c.length > 0 && !d && !i, St = Gt({
|
|
361
407
|
disabled: d,
|
|
362
|
-
error:
|
|
363
|
-
open:
|
|
408
|
+
error: x,
|
|
409
|
+
open: a,
|
|
364
410
|
loading: i,
|
|
365
411
|
hasSelection: c.length > 0
|
|
366
|
-
}),
|
|
412
|
+
}), xe = U(() => w ? /* @__PURE__ */ r(
|
|
367
413
|
"input",
|
|
368
414
|
{
|
|
369
|
-
ref:
|
|
415
|
+
ref: j,
|
|
370
416
|
type: "text",
|
|
371
|
-
value:
|
|
372
|
-
onChange: (e) =>
|
|
373
|
-
onKeyDown:
|
|
417
|
+
value: C,
|
|
418
|
+
onChange: (e) => he(e.target.value),
|
|
419
|
+
onKeyDown: Be,
|
|
374
420
|
disabled: d || i,
|
|
375
421
|
placeholder: c.length === 0 ? b : "",
|
|
376
422
|
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))]",
|
|
@@ -379,156 +425,156 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
379
425
|
}
|
|
380
426
|
}
|
|
381
427
|
) : null, [
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
428
|
+
w,
|
|
429
|
+
C,
|
|
430
|
+
he,
|
|
431
|
+
Be,
|
|
386
432
|
d,
|
|
387
433
|
i,
|
|
388
434
|
c.length,
|
|
389
435
|
b
|
|
390
|
-
]),
|
|
391
|
-
if (
|
|
392
|
-
return
|
|
393
|
-
if (
|
|
394
|
-
const e =
|
|
395
|
-
return /* @__PURE__ */
|
|
436
|
+
]), Tt = U(() => {
|
|
437
|
+
if (k && c.length > 0)
|
|
438
|
+
return k(c);
|
|
439
|
+
if (ae && c.length > 0) {
|
|
440
|
+
const e = pe != null ? c.slice(0, pe) : c, t = c.length - e.length;
|
|
441
|
+
return /* @__PURE__ */ g(
|
|
396
442
|
"div",
|
|
397
443
|
{
|
|
398
444
|
className: "flex items-center gap-1 overflow-hidden min-w-0 flex-1",
|
|
399
445
|
style: { flexWrap: "nowrap" },
|
|
400
446
|
children: [
|
|
401
447
|
e.map((o) => {
|
|
402
|
-
const u =
|
|
448
|
+
const u = te.has(o.value);
|
|
403
449
|
return /* @__PURE__ */ r(
|
|
404
|
-
|
|
450
|
+
Bt,
|
|
405
451
|
{
|
|
406
452
|
value: o.label,
|
|
407
453
|
type: "default",
|
|
408
454
|
textTransform: "none",
|
|
409
|
-
onRemove:
|
|
455
|
+
onRemove: se && !d && !u ? (p) => $e(o.value, p) : void 0,
|
|
410
456
|
className: "shrink-0"
|
|
411
457
|
},
|
|
412
458
|
o.value
|
|
413
459
|
);
|
|
414
460
|
}),
|
|
415
|
-
t > 0 && /* @__PURE__ */
|
|
461
|
+
t > 0 && /* @__PURE__ */ g("span", { className: "shrink-0 text-xs text-[var(--malachite-text-secondary,rgb(123,123,123))]", children: [
|
|
416
462
|
"+",
|
|
417
463
|
t
|
|
418
464
|
] }),
|
|
419
|
-
|
|
465
|
+
xe
|
|
420
466
|
]
|
|
421
467
|
}
|
|
422
468
|
);
|
|
423
469
|
}
|
|
424
|
-
return
|
|
470
|
+
return w && c.length === 0 ? xe : c.length === 0 ? /* @__PURE__ */ r("span", { className: "text-[var(--malachite-text-placeholder)]", children: b }) : c.length === 1 ? /* @__PURE__ */ r("span", { children: c[0].label }) : /* @__PURE__ */ r("span", { children: `${c.length} selected` });
|
|
425
471
|
}, [
|
|
426
472
|
c,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
473
|
+
k,
|
|
474
|
+
ae,
|
|
475
|
+
pe,
|
|
476
|
+
se,
|
|
431
477
|
d,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
478
|
+
$e,
|
|
479
|
+
w,
|
|
480
|
+
xe,
|
|
435
481
|
b,
|
|
436
|
-
|
|
437
|
-
]),
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}, [
|
|
441
|
-
const
|
|
482
|
+
te
|
|
483
|
+
]), _t = n.length === 0 ? "No options available" : "No results found";
|
|
484
|
+
Nt(() => {
|
|
485
|
+
a && Xt();
|
|
486
|
+
}, [a]);
|
|
487
|
+
const kt = {
|
|
442
488
|
position: "fixed",
|
|
443
|
-
top: (
|
|
444
|
-
left: (
|
|
445
|
-
width:
|
|
446
|
-
background:
|
|
447
|
-
border:
|
|
448
|
-
borderRadius:
|
|
449
|
-
boxShadow:
|
|
450
|
-
padding:
|
|
489
|
+
top: (f == null ? void 0 : f.top) ?? 0,
|
|
490
|
+
left: (f == null ? void 0 : f.left) ?? 0,
|
|
491
|
+
width: f == null ? void 0 : f.width,
|
|
492
|
+
background: q.standard.background,
|
|
493
|
+
border: q.standard.border,
|
|
494
|
+
borderRadius: q.standard.radius,
|
|
495
|
+
boxShadow: q.standard.shadow,
|
|
496
|
+
padding: q.standard.padding,
|
|
451
497
|
display: "flex",
|
|
452
498
|
flexDirection: "column",
|
|
453
499
|
gap: 4,
|
|
454
|
-
maxHeight: (
|
|
455
|
-
fontSize:
|
|
456
|
-
visibility:
|
|
457
|
-
opacity:
|
|
458
|
-
},
|
|
459
|
-
/* @__PURE__ */
|
|
500
|
+
maxHeight: (f == null ? void 0 : f.maxHeight) ?? Ft,
|
|
501
|
+
fontSize: Yt[M],
|
|
502
|
+
visibility: f ? "visible" : "hidden",
|
|
503
|
+
opacity: f ? 1 : 0
|
|
504
|
+
}, Ge = !!(ne || Ie || oe || Se || Ee || Te || le), Ue = Ge && !!J, ze = /* @__PURE__ */ g(ye, { children: [
|
|
505
|
+
/* @__PURE__ */ g(
|
|
460
506
|
"div",
|
|
461
507
|
{
|
|
462
|
-
ref:
|
|
508
|
+
ref: ue,
|
|
463
509
|
className: "relative",
|
|
464
|
-
style:
|
|
510
|
+
style: Ze(L),
|
|
465
511
|
onBlur: (e) => {
|
|
466
512
|
var o;
|
|
467
513
|
const t = e.relatedTarget;
|
|
468
|
-
t && ((o =
|
|
469
|
-
var u,
|
|
470
|
-
t && ((u = A.current) != null && u.contains(t)) || (
|
|
514
|
+
t && ((o = ue.current) != null && o.contains(t)) || queueMicrotask(() => {
|
|
515
|
+
var u, p;
|
|
516
|
+
t && ((u = A.current) != null && u.contains(t)) || (p = W.current) == null || p.call(W);
|
|
471
517
|
});
|
|
472
518
|
},
|
|
473
519
|
children: [
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
|
|
520
|
+
/* @__PURE__ */ g(
|
|
521
|
+
lt,
|
|
476
522
|
{
|
|
477
|
-
ref:
|
|
478
|
-
id:
|
|
479
|
-
triggerRole:
|
|
523
|
+
ref: V,
|
|
524
|
+
id: Me,
|
|
525
|
+
triggerRole: w ? "combobox" : ae && se ? "group" : "button",
|
|
480
526
|
disabled: d || i,
|
|
481
|
-
[
|
|
482
|
-
"data-open":
|
|
527
|
+
[Ut]: "",
|
|
528
|
+
"data-open": a || void 0,
|
|
483
529
|
"aria-haspopup": "listbox",
|
|
484
|
-
"aria-expanded":
|
|
485
|
-
"aria-controls":
|
|
486
|
-
"aria-activedescendant":
|
|
487
|
-
"aria-labelledby":
|
|
488
|
-
"aria-label":
|
|
489
|
-
"aria-invalid":
|
|
490
|
-
"aria-required":
|
|
491
|
-
"aria-describedby": [
|
|
530
|
+
"aria-expanded": a,
|
|
531
|
+
"aria-controls": a ? Oe : void 0,
|
|
532
|
+
"aria-activedescendant": w && a && F ? Re : w && a && T >= 0 ? Ne(T) : void 0,
|
|
533
|
+
"aria-labelledby": ft ?? (Ue && !Le ? Ce : void 0),
|
|
534
|
+
"aria-label": Le ?? (Ue ? void 0 : J),
|
|
535
|
+
"aria-invalid": x || void 0,
|
|
536
|
+
"aria-required": le || void 0,
|
|
537
|
+
"aria-describedby": [bt, pt].filter(Boolean).join(" ") || void 0,
|
|
492
538
|
"aria-busy": i || void 0,
|
|
493
539
|
onClick: () => {
|
|
494
|
-
d || i ||
|
|
540
|
+
d || i || de((e) => !e);
|
|
495
541
|
},
|
|
496
|
-
onKeyDown:
|
|
542
|
+
onKeyDown: re,
|
|
497
543
|
style: {
|
|
498
544
|
transition: "border-color 0.15s ease, box-shadow 0.15s ease",
|
|
499
|
-
...
|
|
500
|
-
...
|
|
545
|
+
...St,
|
|
546
|
+
...dt
|
|
501
547
|
},
|
|
502
|
-
className: `w-full ${
|
|
548
|
+
className: `w-full ${ir[M]} border border-solid flex items-center font-normal text-[var(--malachite-text-primary)] ${d || i ? "cursor-not-allowed" : "cursor-pointer"} ${Vt} ${ct}`,
|
|
503
549
|
children: [
|
|
504
550
|
/* @__PURE__ */ r(
|
|
505
551
|
"span",
|
|
506
552
|
{
|
|
507
|
-
className: `flex-1 min-w-0 text-left ${
|
|
508
|
-
children:
|
|
553
|
+
className: `flex-1 min-w-0 text-left ${w ? "flex" : "truncate"} ${Ye ? "pr-[18px]" : ""}`,
|
|
554
|
+
children: Tt
|
|
509
555
|
}
|
|
510
556
|
),
|
|
511
|
-
i ? /* @__PURE__ */ r("span", { className: "flex items-center justify-center shrink-0 size-[14px]", children: /* @__PURE__ */ r(
|
|
512
|
-
|
|
557
|
+
i ? /* @__PURE__ */ r("span", { className: "flex items-center justify-center shrink-0 size-[14px]", children: /* @__PURE__ */ r($t, { size: "xxxsmall" }) }) : /* @__PURE__ */ r(
|
|
558
|
+
Dt,
|
|
513
559
|
{
|
|
514
560
|
size: 13,
|
|
515
561
|
className: "shrink-0",
|
|
516
562
|
style: {
|
|
517
|
-
color:
|
|
563
|
+
color: a ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
|
|
518
564
|
transition: "transform 0.2s ease, color 0.2s ease",
|
|
519
|
-
transform:
|
|
565
|
+
transform: a ? "rotate(180deg)" : "rotate(0deg)"
|
|
520
566
|
}
|
|
521
567
|
}
|
|
522
568
|
)
|
|
523
569
|
]
|
|
524
570
|
}
|
|
525
571
|
),
|
|
526
|
-
|
|
572
|
+
Ye && /* @__PURE__ */ r(
|
|
527
573
|
"button",
|
|
528
574
|
{
|
|
529
575
|
type: "button",
|
|
530
576
|
"aria-label": "Clear selection",
|
|
531
|
-
onClick:
|
|
577
|
+
onClick: It,
|
|
532
578
|
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",
|
|
533
579
|
children: "×"
|
|
534
580
|
}
|
|
@@ -536,18 +582,18 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
536
582
|
]
|
|
537
583
|
}
|
|
538
584
|
),
|
|
539
|
-
|
|
540
|
-
/* @__PURE__ */
|
|
585
|
+
a && Rt(
|
|
586
|
+
/* @__PURE__ */ g(
|
|
541
587
|
"div",
|
|
542
588
|
{
|
|
543
589
|
ref: A,
|
|
544
|
-
id:
|
|
590
|
+
id: Oe,
|
|
545
591
|
role: "listbox",
|
|
546
592
|
"aria-multiselectable": "true",
|
|
547
|
-
...
|
|
548
|
-
style:
|
|
593
|
+
...wt,
|
|
594
|
+
style: kt,
|
|
549
595
|
children: [
|
|
550
|
-
|
|
596
|
+
We && /* @__PURE__ */ g(
|
|
551
597
|
"div",
|
|
552
598
|
{
|
|
553
599
|
style: {
|
|
@@ -562,7 +608,7 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
562
608
|
},
|
|
563
609
|
children: [
|
|
564
610
|
/* @__PURE__ */ r(
|
|
565
|
-
|
|
611
|
+
Ht,
|
|
566
612
|
{
|
|
567
613
|
size: 13,
|
|
568
614
|
style: {
|
|
@@ -575,9 +621,9 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
575
621
|
"input",
|
|
576
622
|
{
|
|
577
623
|
type: "text",
|
|
578
|
-
value:
|
|
579
|
-
onChange: (e) =>
|
|
580
|
-
onKeyDown:
|
|
624
|
+
value: C,
|
|
625
|
+
onChange: (e) => he(e.target.value),
|
|
626
|
+
onKeyDown: re,
|
|
581
627
|
placeholder: "Search",
|
|
582
628
|
"aria-label": "Search options",
|
|
583
629
|
autoFocus: !0,
|
|
@@ -595,22 +641,11 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
595
641
|
]
|
|
596
642
|
}
|
|
597
643
|
),
|
|
598
|
-
|
|
599
|
-
"div",
|
|
600
|
-
{
|
|
601
|
-
"aria-hidden": "true",
|
|
602
|
-
style: {
|
|
603
|
-
height: 1,
|
|
604
|
-
width: "100%",
|
|
605
|
-
background: "var(--malachite-card-border, rgb(232, 232, 232))",
|
|
606
|
-
flexShrink: 0
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
),
|
|
644
|
+
We && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: Je }),
|
|
610
645
|
/* @__PURE__ */ r(
|
|
611
646
|
"div",
|
|
612
647
|
{
|
|
613
|
-
ref:
|
|
648
|
+
ref: Ae,
|
|
614
649
|
style: {
|
|
615
650
|
display: "flex",
|
|
616
651
|
flexDirection: "column",
|
|
@@ -622,34 +657,36 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
622
657
|
scrollbarWidth: "thin",
|
|
623
658
|
scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent"
|
|
624
659
|
},
|
|
625
|
-
children:
|
|
660
|
+
children: $.length === 0 ? (
|
|
626
661
|
// `role="listbox"` admits only option/group children.
|
|
627
|
-
/* @__PURE__ */ r("div", { role: "presentation", style:
|
|
628
|
-
) :
|
|
629
|
-
const o =
|
|
630
|
-
return /* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ r("div", { role: "presentation", style: or, children: _t })
|
|
663
|
+
) : $.map((e, t) => {
|
|
664
|
+
const o = fe.has(e.value), u = t === T, p = !!e.disabled;
|
|
665
|
+
return /* @__PURE__ */ g(
|
|
631
666
|
"button",
|
|
632
667
|
{
|
|
633
|
-
id:
|
|
634
|
-
ref: (
|
|
635
|
-
|
|
668
|
+
id: Ne(t),
|
|
669
|
+
ref: (N) => {
|
|
670
|
+
He.current[t] = N;
|
|
636
671
|
},
|
|
637
672
|
type: "button",
|
|
638
673
|
role: "option",
|
|
639
674
|
"aria-selected": o,
|
|
640
|
-
"aria-disabled":
|
|
675
|
+
"aria-disabled": p || void 0,
|
|
641
676
|
onClick: () => {
|
|
642
|
-
var
|
|
643
|
-
|
|
677
|
+
var N;
|
|
678
|
+
be(e.value), X(), (N = j.current) == null || N.focus();
|
|
679
|
+
},
|
|
680
|
+
onMouseEnter: () => {
|
|
681
|
+
P(!1), D(t);
|
|
644
682
|
},
|
|
645
|
-
onMouseEnter: () => P(t),
|
|
646
683
|
onMouseLeave: () => {
|
|
647
|
-
T === t &&
|
|
684
|
+
T === t && D(-1);
|
|
648
685
|
},
|
|
649
686
|
className: "malachite-multiselect-option",
|
|
650
687
|
"data-checked": o,
|
|
651
688
|
"data-highlighted": u,
|
|
652
|
-
"data-disabled":
|
|
689
|
+
"data-disabled": p,
|
|
653
690
|
style: {
|
|
654
691
|
display: "flex",
|
|
655
692
|
alignItems: "center",
|
|
@@ -658,16 +695,16 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
658
695
|
flexShrink: 0,
|
|
659
696
|
border: "none",
|
|
660
697
|
textAlign: "left",
|
|
661
|
-
borderRadius:
|
|
698
|
+
borderRadius: "var(--malachite-radius-lg, 8px)",
|
|
662
699
|
padding: "8px 10px",
|
|
663
700
|
font: "inherit",
|
|
664
|
-
cursor:
|
|
665
|
-
opacity:
|
|
701
|
+
cursor: p ? "not-allowed" : "pointer",
|
|
702
|
+
opacity: p ? 0.6 : 1,
|
|
666
703
|
color: o ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))"
|
|
667
704
|
},
|
|
668
705
|
children: [
|
|
669
|
-
/* @__PURE__ */ r(
|
|
670
|
-
|
|
706
|
+
/* @__PURE__ */ r(fr, { option: e }),
|
|
707
|
+
jt(e.badge) && /* @__PURE__ */ r(
|
|
671
708
|
"span",
|
|
672
709
|
{
|
|
673
710
|
style: {
|
|
@@ -675,7 +712,7 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
675
712
|
flexShrink: 0,
|
|
676
713
|
paddingLeft: 8
|
|
677
714
|
},
|
|
678
|
-
children: /* @__PURE__ */ r(
|
|
715
|
+
children: /* @__PURE__ */ r(we.Suspense, { fallback: null, children: /* @__PURE__ */ r(nr, { children: e.badge }) })
|
|
679
716
|
}
|
|
680
717
|
)
|
|
681
718
|
]
|
|
@@ -684,65 +721,89 @@ const Fe = 0.2, Ue = 420, rr = ({ option: n }) => {
|
|
|
684
721
|
);
|
|
685
722
|
})
|
|
686
723
|
}
|
|
687
|
-
)
|
|
724
|
+
),
|
|
725
|
+
S && /* @__PURE__ */ g(ye, { children: [
|
|
726
|
+
/* @__PURE__ */ r("div", { "aria-hidden": "true", style: Je }),
|
|
727
|
+
/* @__PURE__ */ g(
|
|
728
|
+
"button",
|
|
729
|
+
{
|
|
730
|
+
id: Re,
|
|
731
|
+
type: "button",
|
|
732
|
+
role: "option",
|
|
733
|
+
"aria-selected": !1,
|
|
734
|
+
onClick: ge,
|
|
735
|
+
onMouseEnter: () => {
|
|
736
|
+
D(-1), P(!0);
|
|
737
|
+
},
|
|
738
|
+
onMouseLeave: () => P(!1),
|
|
739
|
+
className: "malachite-multiselect-option",
|
|
740
|
+
"data-highlighted": F,
|
|
741
|
+
style: lr,
|
|
742
|
+
children: [
|
|
743
|
+
/* @__PURE__ */ r("span", { style: ar, children: S.label }),
|
|
744
|
+
S.icon && /* @__PURE__ */ r("span", { "aria-hidden": "true", style: sr, children: S.icon })
|
|
745
|
+
]
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
] })
|
|
688
749
|
]
|
|
689
750
|
}
|
|
690
751
|
),
|
|
691
752
|
document.body
|
|
692
753
|
)
|
|
693
754
|
] });
|
|
694
|
-
return
|
|
695
|
-
|
|
755
|
+
return Ge ? /* @__PURE__ */ r(
|
|
756
|
+
Mt,
|
|
696
757
|
{
|
|
697
|
-
label:
|
|
698
|
-
hint:
|
|
699
|
-
hintIcon:
|
|
700
|
-
rightSideContent:
|
|
701
|
-
tooltip:
|
|
702
|
-
name:
|
|
703
|
-
required:
|
|
704
|
-
requiredIndicator:
|
|
758
|
+
label: J,
|
|
759
|
+
hint: oe,
|
|
760
|
+
hintIcon: st,
|
|
761
|
+
rightSideContent: Se,
|
|
762
|
+
tooltip: Ie,
|
|
763
|
+
name: Ee ?? "",
|
|
764
|
+
required: le,
|
|
765
|
+
requiredIndicator: it,
|
|
705
766
|
loading: i,
|
|
706
|
-
formControl:
|
|
707
|
-
description:
|
|
708
|
-
controlId:
|
|
709
|
-
labelId:
|
|
710
|
-
descriptionId:
|
|
711
|
-
hintId:
|
|
712
|
-
loadingComponent:
|
|
713
|
-
children:
|
|
767
|
+
formControl: Te,
|
|
768
|
+
description: ne,
|
|
769
|
+
controlId: Me,
|
|
770
|
+
labelId: Ce,
|
|
771
|
+
descriptionId: ht,
|
|
772
|
+
hintId: gt,
|
|
773
|
+
loadingComponent: L === void 0 ? /* @__PURE__ */ r(je, { heightClass: Z[M] }) : /* @__PURE__ */ r("div", { style: Ze(L), children: /* @__PURE__ */ r(je, { heightClass: Z[M] }) }),
|
|
774
|
+
children: ze
|
|
714
775
|
}
|
|
715
|
-
) :
|
|
716
|
-
},
|
|
776
|
+
) : ze;
|
|
777
|
+
}, pr = ({
|
|
717
778
|
formControl: n,
|
|
718
779
|
name: y,
|
|
719
|
-
error:
|
|
780
|
+
error: I,
|
|
720
781
|
onChange: s,
|
|
721
782
|
...b
|
|
722
783
|
}) => {
|
|
723
|
-
const
|
|
724
|
-
return /* @__PURE__ */ r(
|
|
725
|
-
const
|
|
726
|
-
return /* @__PURE__ */
|
|
784
|
+
const k = `${tt()}-error`;
|
|
785
|
+
return /* @__PURE__ */ r(Wt, { control: n, name: y, children: ({ error: z, message: M, onFieldChange: L, onFieldBlur: H, value: d }) => {
|
|
786
|
+
const x = I === !1 ? void 0 : M;
|
|
787
|
+
return /* @__PURE__ */ g(ye, { children: [
|
|
727
788
|
/* @__PURE__ */ r(
|
|
728
|
-
|
|
789
|
+
at,
|
|
729
790
|
{
|
|
730
791
|
...b,
|
|
731
792
|
name: y,
|
|
732
793
|
value: Array.isArray(d) ? d : [],
|
|
733
|
-
error:
|
|
734
|
-
errorMessageId:
|
|
735
|
-
onFieldLeave:
|
|
794
|
+
error: I ?? z,
|
|
795
|
+
errorMessageId: x ? k : void 0,
|
|
796
|
+
onFieldLeave: H,
|
|
736
797
|
onChange: (i) => {
|
|
737
|
-
|
|
798
|
+
L == null || L(i), s == null || s(i);
|
|
738
799
|
}
|
|
739
800
|
}
|
|
740
801
|
),
|
|
741
|
-
/* @__PURE__ */ r(
|
|
802
|
+
/* @__PURE__ */ r(Pt, { id: k, message: x, spaced: !0 })
|
|
742
803
|
] });
|
|
743
804
|
} });
|
|
744
|
-
},
|
|
805
|
+
}, Yr = (n) => n.formControl ? /* @__PURE__ */ r(pr, { ...n }) : /* @__PURE__ */ r(at, { ...n });
|
|
745
806
|
export {
|
|
746
|
-
|
|
807
|
+
Yr as default
|
|
747
808
|
};
|
|
748
809
|
//# sourceMappingURL=MultiSelect.js.map
|