@wrdagency/blockout 0.1.9 → 0.1.10
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as I, jsxs as X, Fragment as we } from "react/jsx-runtime";
|
|
2
2
|
import { normalizeOption as Bt } from "../../../types/options.js";
|
|
3
3
|
import { cn as jt } from "../../../utils/css.js";
|
|
4
4
|
import { noop as Wt } from "../../../utils/noop.js";
|
|
@@ -11,7 +11,7 @@ import { BaseControl as zt } from "../base-control/index.js";
|
|
|
11
11
|
import { Affix as Fe } from "../base-control/affix.js";
|
|
12
12
|
import { useBaseControlProps as Qt } from "../base-control/props.js";
|
|
13
13
|
import { C as Xt, a as Gt } from "../../../P7GR5CS5-BoOYUfSQ.js";
|
|
14
|
-
import { a as ne, _ as oe, i as me, m as
|
|
14
|
+
import { a as ne, _ as oe, i as me, m as U, o as A, v as Ge, f as re, q as le, $ as Je, Y as ie, X as D, U as $, Z as Me, j as H, e as Q, H as et, l as he, n as ye, ab as tt, r as nt, s as Ae, t as Jt, P as ot, Q as rt, R as en, h as tn, u as nn, ac as lt, c as on, a0 as rn, A as ln, ad as sn, ae as an, af as un, x as Be, ag as Ie, a6 as cn, B as dn, b as Ve, a9 as mn, W as fn, K as vn, k as pn } from "../../../LMDWO4NN--KEvZePp.js";
|
|
15
15
|
import { c as st, b as at, f as bn, e as hn, d as Sn, g as gn } from "../../../WMYDSCNQ-Dy1O-Kdl.js";
|
|
16
16
|
import { c as it, d as ut, b as ct } from "../../../4CMBR7SL-BAGv8IL2.js";
|
|
17
17
|
import { m as dt, o as Cn, t as mt, c as ft, s as G, b as J, g as vt, e as pt, f as be, u as bt, a as En, p as On } from "../../../YV4JVR4I-kvospPUa.js";
|
|
@@ -37,8 +37,8 @@ var Mn = "span", Nn = {
|
|
|
37
37
|
e,
|
|
38
38
|
process.env.NODE_ENV !== "production" && "PopoverDisclosureArrow must be wrapped in a PopoverDisclosure component."
|
|
39
39
|
);
|
|
40
|
-
const
|
|
41
|
-
() => /* @__PURE__ */
|
|
40
|
+
const f = e.useState((s) => r || s.placement).split("-")[0], c = Nn[f], i = Ce(
|
|
41
|
+
() => /* @__PURE__ */ I(
|
|
42
42
|
"svg",
|
|
43
43
|
{
|
|
44
44
|
display: "block",
|
|
@@ -50,12 +50,12 @@ var Mn = "span", Nn = {
|
|
|
50
50
|
viewBox: "0 0 16 16",
|
|
51
51
|
height: "1em",
|
|
52
52
|
width: "1em",
|
|
53
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ I("polyline", { points: c })
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
56
|
[c]
|
|
57
57
|
);
|
|
58
|
-
return l =
|
|
58
|
+
return l = U(A({
|
|
59
59
|
children: i,
|
|
60
60
|
"aria-hidden": !0
|
|
61
61
|
}, l), {
|
|
@@ -123,12 +123,12 @@ function Dn(t = {}) {
|
|
|
123
123
|
l.placement,
|
|
124
124
|
"bottom-start"
|
|
125
125
|
)
|
|
126
|
-
})),
|
|
126
|
+
})), f = new String(""), c = ie($($({}, a.getState()), m.getState()), {
|
|
127
127
|
value: D(
|
|
128
128
|
e.value,
|
|
129
129
|
l.value,
|
|
130
130
|
e.defaultValue,
|
|
131
|
-
|
|
131
|
+
f
|
|
132
132
|
),
|
|
133
133
|
setValueOnMove: D(
|
|
134
134
|
e.setValueOnMove,
|
|
@@ -142,11 +142,11 @@ function Dn(t = {}) {
|
|
|
142
142
|
return G(
|
|
143
143
|
i,
|
|
144
144
|
() => J(i, ["value", "items"], (s) => {
|
|
145
|
-
if (s.value !==
|
|
146
|
-
const
|
|
145
|
+
if (s.value !== f || !s.items.length) return;
|
|
146
|
+
const v = s.items.find(
|
|
147
147
|
(C) => !C.disabled && C.value != null
|
|
148
148
|
);
|
|
149
|
-
(
|
|
149
|
+
(v == null ? void 0 : v.value) != null && i.setState("value", v.value);
|
|
150
150
|
})
|
|
151
151
|
), G(
|
|
152
152
|
i,
|
|
@@ -157,7 +157,7 @@ function Dn(t = {}) {
|
|
|
157
157
|
i,
|
|
158
158
|
() => J(i, ["mounted", "items", "value"], (s) => {
|
|
159
159
|
if (o || s.mounted) return;
|
|
160
|
-
const
|
|
160
|
+
const v = Ct(s.value), C = v[v.length - 1];
|
|
161
161
|
if (C == null) return;
|
|
162
162
|
const d = s.items.find(
|
|
163
163
|
(p) => !p.disabled && p.value === C
|
|
@@ -167,8 +167,8 @@ function Dn(t = {}) {
|
|
|
167
167
|
), G(
|
|
168
168
|
i,
|
|
169
169
|
() => vt(i, ["setValueOnMove", "moves"], (s) => {
|
|
170
|
-
const { mounted:
|
|
171
|
-
if (!s.setValueOnMove &&
|
|
170
|
+
const { mounted: v, value: C, activeId: d } = i.getState();
|
|
171
|
+
if (!s.setValueOnMove && v || Array.isArray(C) || !s.moves || !d) return;
|
|
172
172
|
const p = a.item(d);
|
|
173
173
|
!p || p.disabled || p.value == null || i.setState("value", p.value);
|
|
174
174
|
})
|
|
@@ -182,7 +182,7 @@ function Dn(t = {}) {
|
|
|
182
182
|
}
|
|
183
183
|
function Ln(t) {
|
|
184
184
|
const n = ht();
|
|
185
|
-
return t =
|
|
185
|
+
return t = U(A({}, t), {
|
|
186
186
|
combobox: t.combobox !== void 0 ? t.combobox : n
|
|
187
187
|
}), ut(t);
|
|
188
188
|
}
|
|
@@ -235,7 +235,7 @@ var jn = ne(function(n) {
|
|
|
235
235
|
form: l,
|
|
236
236
|
required: a,
|
|
237
237
|
showOnKeyDown: m = !0,
|
|
238
|
-
moveOnKeyDown:
|
|
238
|
+
moveOnKeyDown: f = !0,
|
|
239
239
|
toggleOnPress: c = !0,
|
|
240
240
|
toggleOnClick: i = c
|
|
241
241
|
} = o, s = oe(o, [
|
|
@@ -248,12 +248,12 @@ var jn = ne(function(n) {
|
|
|
248
248
|
"toggleOnPress",
|
|
249
249
|
"toggleOnClick"
|
|
250
250
|
]);
|
|
251
|
-
const
|
|
252
|
-
e = e ||
|
|
251
|
+
const v = De();
|
|
252
|
+
e = e || v, me(
|
|
253
253
|
e,
|
|
254
254
|
process.env.NODE_ENV !== "production" && "Select must receive a `store` prop or be wrapped in a SelectProvider component."
|
|
255
255
|
);
|
|
256
|
-
const C = s.onKeyDown, d =
|
|
256
|
+
const C = s.onKeyDown, d = H(m), p = H(f), O = e.useState("placement").split("-")[0], g = e.useState("value"), R = Array.isArray(g), K = Q((S) => {
|
|
257
257
|
var E;
|
|
258
258
|
if (C == null || C(S), S.defaultPrevented || !e) return;
|
|
259
259
|
const { orientation: q, items: Y, activeId: ee } = e.getState(), fe = q !== "horizontal", ue = q !== "vertical", M = !!((E = Y.find((Ee) => !Ee.disabled && Ee.value != null)) != null && E.rowId), pe = {
|
|
@@ -273,21 +273,21 @@ var jn = ne(function(n) {
|
|
|
273
273
|
});
|
|
274
274
|
s = he(
|
|
275
275
|
s,
|
|
276
|
-
(S) => /* @__PURE__ */
|
|
276
|
+
(S) => /* @__PURE__ */ I(Et, { value: e, children: S }),
|
|
277
277
|
[e]
|
|
278
278
|
);
|
|
279
|
-
const [
|
|
279
|
+
const [P, _] = de(!1), w = se(!1);
|
|
280
280
|
ae(() => {
|
|
281
|
-
const S =
|
|
282
|
-
|
|
281
|
+
const S = w.current;
|
|
282
|
+
w.current = !1, !S && _(!1);
|
|
283
283
|
}, [g]);
|
|
284
|
-
const
|
|
284
|
+
const B = e.useState((S) => {
|
|
285
285
|
var E;
|
|
286
286
|
return (E = S.labelElement) == null ? void 0 : E.id;
|
|
287
|
-
}), b = s["aria-label"], y = s["aria-labelledby"] ||
|
|
287
|
+
}), b = s["aria-label"], y = s["aria-labelledby"] || B, j = e.useState((S) => {
|
|
288
288
|
if (r)
|
|
289
289
|
return S.items;
|
|
290
|
-
}),
|
|
290
|
+
}), W = Ce(() => [...new Set(j == null ? void 0 : j.map((S) => S.value).filter((S) => S != null))], [j]);
|
|
291
291
|
s = he(
|
|
292
292
|
s,
|
|
293
293
|
(S) => r ? /* @__PURE__ */ X(we, { children: [
|
|
@@ -314,19 +314,19 @@ var jn = ne(function(n) {
|
|
|
314
314
|
required: a,
|
|
315
315
|
disabled: s.disabled,
|
|
316
316
|
value: g,
|
|
317
|
-
multiple:
|
|
317
|
+
multiple: R,
|
|
318
318
|
onFocus: () => {
|
|
319
319
|
var E;
|
|
320
320
|
return (E = e == null ? void 0 : e.getState().selectElement) == null ? void 0 : E.focus();
|
|
321
321
|
},
|
|
322
322
|
onChange: (E) => {
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
w.current = !0, _(!0), e == null || e.setValue(
|
|
324
|
+
R ? Bn(E.target) : E.target.value
|
|
325
325
|
);
|
|
326
326
|
},
|
|
327
327
|
children: [
|
|
328
|
-
Ct(g).map((E) => E == null ||
|
|
329
|
-
|
|
328
|
+
Ct(g).map((E) => E == null || W.includes(E) ? null : /* @__PURE__ */ I("option", { value: E, children: E }, E)),
|
|
329
|
+
W.map((E) => /* @__PURE__ */ I("option", { value: E, children: E }, E))
|
|
330
330
|
]
|
|
331
331
|
}
|
|
332
332
|
),
|
|
@@ -340,26 +340,26 @@ var jn = ne(function(n) {
|
|
|
340
340
|
l,
|
|
341
341
|
a,
|
|
342
342
|
g,
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
R,
|
|
344
|
+
W,
|
|
345
345
|
s.disabled
|
|
346
346
|
]
|
|
347
347
|
);
|
|
348
348
|
const h = /* @__PURE__ */ X(we, { children: [
|
|
349
349
|
g,
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
] }),
|
|
352
|
-
return s =
|
|
350
|
+
/* @__PURE__ */ I(Un, {})
|
|
351
|
+
] }), k = e.useState("contentElement");
|
|
352
|
+
return s = U(A({
|
|
353
353
|
role: "combobox",
|
|
354
354
|
"aria-autocomplete": "none",
|
|
355
|
-
"aria-labelledby":
|
|
356
|
-
"aria-haspopup": tt(
|
|
357
|
-
"data-autofill":
|
|
355
|
+
"aria-labelledby": B,
|
|
356
|
+
"aria-haspopup": tt(k, "listbox"),
|
|
357
|
+
"data-autofill": P || void 0,
|
|
358
358
|
"data-name": r,
|
|
359
359
|
children: h
|
|
360
360
|
}, s), {
|
|
361
361
|
ref: ye(e.setSelectElement, s.ref),
|
|
362
|
-
onKeyDown:
|
|
362
|
+
onKeyDown: K
|
|
363
363
|
}), s = bn(A({ store: e, toggleOnClick: i }, s)), s = Ot(A({ store: e }, s)), s;
|
|
364
364
|
}), Wn = re(function(n) {
|
|
365
365
|
const o = jn(n);
|
|
@@ -367,7 +367,7 @@ var jn = ne(function(n) {
|
|
|
367
367
|
});
|
|
368
368
|
function Zn(t = {}) {
|
|
369
369
|
const n = Rn(t);
|
|
370
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ I(Pn, { value: n, children: t.children });
|
|
371
371
|
}
|
|
372
372
|
var $n = "div";
|
|
373
373
|
function qn(t, n) {
|
|
@@ -382,7 +382,7 @@ var Yn = ne(
|
|
|
382
382
|
getItem: l,
|
|
383
383
|
hideOnClick: a,
|
|
384
384
|
setValueOnClick: m = r != null,
|
|
385
|
-
preventScrollOnKeyDown:
|
|
385
|
+
preventScrollOnKeyDown: f = !0,
|
|
386
386
|
focusOnHover: c = !0
|
|
387
387
|
} = o, i = oe(o, [
|
|
388
388
|
"store",
|
|
@@ -393,8 +393,8 @@ var Yn = ne(
|
|
|
393
393
|
"preventScrollOnKeyDown",
|
|
394
394
|
"focusOnHover"
|
|
395
395
|
]), s;
|
|
396
|
-
const
|
|
397
|
-
e = e ||
|
|
396
|
+
const v = Vn();
|
|
397
|
+
e = e || v, me(
|
|
398
398
|
e,
|
|
399
399
|
process.env.NODE_ENV !== "production" && "SelectItem must be wrapped in a SelectList or SelectPopover component."
|
|
400
400
|
);
|
|
@@ -409,9 +409,9 @@ var Yn = ne(
|
|
|
409
409
|
autoFocus(b) {
|
|
410
410
|
return r == null || b.value == null || b.activeId !== C && (e != null && e.item(b.activeId)) ? !1 : Array.isArray(b.value) ? b.value[b.value.length - 1] === r : b.value === r;
|
|
411
411
|
}
|
|
412
|
-
}),
|
|
412
|
+
}), R = Xe(
|
|
413
413
|
(b) => {
|
|
414
|
-
const y =
|
|
414
|
+
const y = U(A({}, b), {
|
|
415
415
|
value: d ? void 0 : r,
|
|
416
416
|
children: r
|
|
417
417
|
});
|
|
@@ -420,35 +420,35 @@ var Yn = ne(
|
|
|
420
420
|
[d, r, l]
|
|
421
421
|
);
|
|
422
422
|
a = a ?? (r != null && !V);
|
|
423
|
-
const
|
|
424
|
-
|
|
423
|
+
const K = i.onClick, P = H(m), _ = H(a), w = Q((b) => {
|
|
424
|
+
K == null || K(b), !b.defaultPrevented && (ot(b) || rt(b) || (P(b) && r != null && (e == null || e.setValue((y) => Array.isArray(y) ? y.includes(r) ? y.filter((j) => j !== r) : [...y, r] : r)), _(b) && (e == null || e.hide())));
|
|
425
425
|
});
|
|
426
426
|
i = he(
|
|
427
427
|
i,
|
|
428
|
-
(b) => /* @__PURE__ */
|
|
428
|
+
(b) => /* @__PURE__ */ I(_n.Provider, { value: O ?? !1, children: b }),
|
|
429
429
|
[O]
|
|
430
|
-
), i =
|
|
430
|
+
), i = U(A({
|
|
431
431
|
id: C,
|
|
432
432
|
role: en(p),
|
|
433
433
|
"aria-selected": O,
|
|
434
434
|
children: r
|
|
435
435
|
}, i), {
|
|
436
436
|
autoFocus: (s = i.autoFocus) != null ? s : g,
|
|
437
|
-
onClick:
|
|
437
|
+
onClick: w
|
|
438
438
|
}), i = It(A({
|
|
439
439
|
store: e,
|
|
440
|
-
getItem:
|
|
441
|
-
preventScrollOnKeyDown:
|
|
440
|
+
getItem: R,
|
|
441
|
+
preventScrollOnKeyDown: f
|
|
442
442
|
}, i));
|
|
443
|
-
const
|
|
444
|
-
return i = xt(
|
|
443
|
+
const B = H(c);
|
|
444
|
+
return i = xt(U(A({
|
|
445
445
|
store: e
|
|
446
446
|
}, i), {
|
|
447
447
|
// We have to disable focusOnHover when the popup is closed, otherwise
|
|
448
448
|
// the active item will change to null (the container) when the popup is
|
|
449
449
|
// closed by clicking on an item.
|
|
450
450
|
focusOnHover(b) {
|
|
451
|
-
if (!
|
|
451
|
+
if (!B(b)) return !1;
|
|
452
452
|
const y = e == null ? void 0 : e.getState();
|
|
453
453
|
return !!(y != null && y.open);
|
|
454
454
|
}
|
|
@@ -467,7 +467,7 @@ var Yn = ne(
|
|
|
467
467
|
hideOnEnter: l = !0,
|
|
468
468
|
focusOnMove: a = !0,
|
|
469
469
|
composite: m,
|
|
470
|
-
alwaysVisible:
|
|
470
|
+
alwaysVisible: f
|
|
471
471
|
} = o, c = oe(o, [
|
|
472
472
|
"store",
|
|
473
473
|
"resetOnEscape",
|
|
@@ -481,29 +481,29 @@ var Yn = ne(
|
|
|
481
481
|
e,
|
|
482
482
|
process.env.NODE_ENV !== "production" && "SelectList must receive a `store` prop or be wrapped in a SelectProvider component."
|
|
483
483
|
);
|
|
484
|
-
const s = Ae(c.id),
|
|
484
|
+
const s = Ae(c.id), v = e.useState("value"), C = Array.isArray(v), [d, p] = de(v), V = e.useState("mounted");
|
|
485
485
|
ae(() => {
|
|
486
|
-
V || p(
|
|
487
|
-
}, [V,
|
|
488
|
-
const O = c.onKeyDown, g =
|
|
489
|
-
O == null || O(M), !M.defaultPrevented && (M.key === "Escape" && g(M) && (e == null || e.setValue(d)), (M.key === " " || M.key === "Enter") && tn(M) &&
|
|
490
|
-
}),
|
|
491
|
-
() => [
|
|
492
|
-
[
|
|
493
|
-
), [y,
|
|
486
|
+
V || p(v);
|
|
487
|
+
}, [V, v]), r = r && !C;
|
|
488
|
+
const O = c.onKeyDown, g = H(r), R = H(l), K = Q((M) => {
|
|
489
|
+
O == null || O(M), !M.defaultPrevented && (M.key === "Escape" && g(M) && (e == null || e.setValue(d)), (M.key === " " || M.key === "Enter") && tn(M) && R(M) && (M.preventDefault(), e == null || e.hide()));
|
|
490
|
+
}), P = Pe(je), _ = de(), [w, B] = P || _, b = Ce(
|
|
491
|
+
() => [w, B],
|
|
492
|
+
[w]
|
|
493
|
+
), [y, j] = de(null), W = Pe(We);
|
|
494
494
|
ae(() => {
|
|
495
|
-
if (
|
|
496
|
-
return
|
|
497
|
-
}, [
|
|
495
|
+
if (W)
|
|
496
|
+
return W(e), () => W(null);
|
|
497
|
+
}, [W, e]), c = he(
|
|
498
498
|
c,
|
|
499
|
-
(M) => /* @__PURE__ */
|
|
499
|
+
(M) => /* @__PURE__ */ I(Et, { value: e, children: /* @__PURE__ */ I(We.Provider, { value: j, children: /* @__PURE__ */ I(je.Provider, { value: b, children: M }) }) }),
|
|
500
500
|
[e, b]
|
|
501
501
|
);
|
|
502
502
|
const h = !!e.combobox;
|
|
503
503
|
m = m ?? (!h && y !== e);
|
|
504
|
-
const [
|
|
504
|
+
const [k, S] = nn(
|
|
505
505
|
m ? e.setListElement : null
|
|
506
|
-
), E = lt(
|
|
506
|
+
), E = lt(k, "role", c.role), Y = (m || (E === "listbox" || E === "menu" || E === "tree" || E === "grid")) && C || void 0, ee = yt(V, c.hidden, f), fe = ee ? U(A({}, c.style), { display: "none" }) : c.style;
|
|
507
507
|
m && (c = A({
|
|
508
508
|
role: "listbox",
|
|
509
509
|
"aria-multiselectable": Y
|
|
@@ -511,18 +511,18 @@ var Yn = ne(
|
|
|
511
511
|
const ue = e.useState(
|
|
512
512
|
(M) => {
|
|
513
513
|
var ve;
|
|
514
|
-
return
|
|
514
|
+
return w || ((ve = M.labelElement) == null ? void 0 : ve.id);
|
|
515
515
|
}
|
|
516
516
|
);
|
|
517
|
-
return c =
|
|
517
|
+
return c = U(A({
|
|
518
518
|
id: s,
|
|
519
519
|
"aria-labelledby": ue,
|
|
520
520
|
hidden: ee
|
|
521
521
|
}, c), {
|
|
522
522
|
ref: ye(S, c.ref),
|
|
523
523
|
style: fe,
|
|
524
|
-
onKeyDown:
|
|
525
|
-
}), c = At(
|
|
524
|
+
onKeyDown: K
|
|
525
|
+
}), c = At(U(A({ store: e }, c), { composite: m })), c = Ot(A({ store: e, typeahead: !h }, c)), c;
|
|
526
526
|
}
|
|
527
527
|
), Xn = re(function(n) {
|
|
528
528
|
const o = Pt(n);
|
|
@@ -571,7 +571,7 @@ function lo(t = {}) {
|
|
|
571
571
|
a == null ? void 0 : a.activeId,
|
|
572
572
|
e.defaultActiveId,
|
|
573
573
|
null
|
|
574
|
-
),
|
|
574
|
+
), f = it(ie($({}, e), {
|
|
575
575
|
activeId: m,
|
|
576
576
|
includesBaseElement: D(
|
|
577
577
|
e.includesBaseElement,
|
|
@@ -607,21 +607,21 @@ function lo(t = {}) {
|
|
|
607
607
|
l == null ? void 0 : l.values,
|
|
608
608
|
e.defaultSelectedValue,
|
|
609
609
|
""
|
|
610
|
-
),
|
|
610
|
+
), v = Array.isArray(s), C = ie($($({}, f.getState()), c.getState()), {
|
|
611
611
|
value: i,
|
|
612
612
|
selectedValue: s,
|
|
613
613
|
resetValueOnSelect: D(
|
|
614
614
|
e.resetValueOnSelect,
|
|
615
615
|
a == null ? void 0 : a.resetValueOnSelect,
|
|
616
|
-
|
|
616
|
+
v
|
|
617
617
|
),
|
|
618
618
|
resetValueOnHide: D(
|
|
619
619
|
e.resetValueOnHide,
|
|
620
620
|
a == null ? void 0 : a.resetValueOnHide,
|
|
621
|
-
|
|
621
|
+
v && !o
|
|
622
622
|
),
|
|
623
623
|
activeValue: a == null ? void 0 : a.activeValue
|
|
624
|
-
}), d = ft(C,
|
|
624
|
+
}), d = ft(C, f, c, r);
|
|
625
625
|
return ro && G(
|
|
626
626
|
d,
|
|
627
627
|
() => J(d, ["virtualFocus"], () => {
|
|
@@ -656,10 +656,10 @@ function lo(t = {}) {
|
|
|
656
656
|
d,
|
|
657
657
|
() => vt(d, ["moves", "renderedItems"], (p, V) => {
|
|
658
658
|
if (p.moves === V.moves) return;
|
|
659
|
-
const { activeId: O } = d.getState(), g =
|
|
659
|
+
const { activeId: O } = d.getState(), g = f.item(O);
|
|
660
660
|
d.setState("activeValue", g == null ? void 0 : g.value);
|
|
661
661
|
})
|
|
662
|
-
), ie($($($({}, c),
|
|
662
|
+
), ie($($($({}, c), f), d), {
|
|
663
663
|
tag: o,
|
|
664
664
|
setValue: (p) => d.setState("value", p),
|
|
665
665
|
resetValue: () => d.setState("value", C.value),
|
|
@@ -668,7 +668,7 @@ function lo(t = {}) {
|
|
|
668
668
|
}
|
|
669
669
|
function so(t) {
|
|
670
670
|
const n = oo();
|
|
671
|
-
return t =
|
|
671
|
+
return t = U(A({}, t), {
|
|
672
672
|
tag: t.tag !== void 0 ? t.tag : n
|
|
673
673
|
}), ut(t);
|
|
674
674
|
}
|
|
@@ -717,12 +717,12 @@ var vo = ne(
|
|
|
717
717
|
autoSelect: l = !1,
|
|
718
718
|
getAutoSelectId: a,
|
|
719
719
|
setValueOnChange: m,
|
|
720
|
-
showMinLength:
|
|
720
|
+
showMinLength: f = 0,
|
|
721
721
|
showOnChange: c,
|
|
722
722
|
showOnMouseDown: i,
|
|
723
723
|
showOnClick: s = i,
|
|
724
|
-
showOnKeyDown:
|
|
725
|
-
showOnKeyPress: C =
|
|
724
|
+
showOnKeyDown: v,
|
|
725
|
+
showOnKeyPress: C = v,
|
|
726
726
|
blurActiveItemOnClick: d,
|
|
727
727
|
setValueOnClick: p = !0,
|
|
728
728
|
moveOnKeyPress: V = !0,
|
|
@@ -744,68 +744,68 @@ var vo = ne(
|
|
|
744
744
|
"moveOnKeyPress",
|
|
745
745
|
"autoComplete"
|
|
746
746
|
]);
|
|
747
|
-
const
|
|
748
|
-
e = e ||
|
|
747
|
+
const R = ht();
|
|
748
|
+
e = e || R, me(
|
|
749
749
|
e,
|
|
750
750
|
process.env.NODE_ENV !== "production" && "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
751
751
|
);
|
|
752
|
-
const
|
|
752
|
+
const K = se(null), [P, _] = an(), w = se(!1), B = se(!1), b = e.useState(
|
|
753
753
|
(u) => u.virtualFocus && l
|
|
754
|
-
), y = O === "inline" || O === "both", [
|
|
754
|
+
), y = O === "inline" || O === "both", [j, W] = de(y);
|
|
755
755
|
un(() => {
|
|
756
|
-
y &&
|
|
756
|
+
y && W(!0);
|
|
757
757
|
}, [y]);
|
|
758
|
-
const h = e.useState("value"),
|
|
759
|
-
ae(() => J(e, ["selectedValue", "activeId"], (u,
|
|
760
|
-
|
|
758
|
+
const h = e.useState("value"), k = se();
|
|
759
|
+
ae(() => J(e, ["selectedValue", "activeId"], (u, x) => {
|
|
760
|
+
k.current = x.selectedValue;
|
|
761
761
|
}), []);
|
|
762
762
|
const S = e.useState((u) => {
|
|
763
|
-
var
|
|
764
|
-
if (y &&
|
|
763
|
+
var x;
|
|
764
|
+
if (y && j && !(u.activeValue && Array.isArray(u.selectedValue) && (u.selectedValue.includes(u.activeValue) || (x = k.current) != null && x.includes(u.activeValue))))
|
|
765
765
|
return u.activeValue;
|
|
766
766
|
}), E = e.useState("renderedItems"), q = e.useState("open"), Y = e.useState("contentElement"), ee = Ce(() => {
|
|
767
|
-
if (!y || !
|
|
767
|
+
if (!y || !j) return h;
|
|
768
768
|
if (Ze(
|
|
769
769
|
E,
|
|
770
770
|
S,
|
|
771
771
|
b
|
|
772
772
|
)) {
|
|
773
773
|
if ($e(h, S)) {
|
|
774
|
-
const
|
|
775
|
-
return h +
|
|
774
|
+
const x = (S == null ? void 0 : S.slice(h.length)) || "";
|
|
775
|
+
return h + x;
|
|
776
776
|
}
|
|
777
777
|
return h;
|
|
778
778
|
}
|
|
779
779
|
return S || h;
|
|
780
|
-
}, [y,
|
|
780
|
+
}, [y, j, E, S, b, h]);
|
|
781
781
|
ae(() => {
|
|
782
|
-
const u =
|
|
782
|
+
const u = K.current;
|
|
783
783
|
if (!u) return;
|
|
784
|
-
const
|
|
785
|
-
return u.addEventListener("combobox-item-move",
|
|
786
|
-
u.removeEventListener("combobox-item-move",
|
|
784
|
+
const x = () => W(!0);
|
|
785
|
+
return u.addEventListener("combobox-item-move", x), () => {
|
|
786
|
+
u.removeEventListener("combobox-item-move", x);
|
|
787
787
|
};
|
|
788
788
|
}, []), ae(() => {
|
|
789
|
-
if (!y || !
|
|
789
|
+
if (!y || !j || !S || !Ze(
|
|
790
790
|
E,
|
|
791
791
|
S,
|
|
792
792
|
b
|
|
793
793
|
) || !$e(h, S)) return;
|
|
794
|
-
let
|
|
794
|
+
let x = cn;
|
|
795
795
|
return queueMicrotask(() => {
|
|
796
|
-
const L =
|
|
796
|
+
const L = K.current;
|
|
797
797
|
if (!L) return;
|
|
798
|
-
const { start: T, end: z } = Be(L), te = h.length,
|
|
799
|
-
Ie(L, te,
|
|
798
|
+
const { start: T, end: z } = Be(L), te = h.length, F = S.length;
|
|
799
|
+
Ie(L, te, F), x = () => {
|
|
800
800
|
if (!_e(L)) return;
|
|
801
801
|
const { start: ce, end: Ft } = Be(L);
|
|
802
|
-
ce === te && Ft ===
|
|
802
|
+
ce === te && Ft === F && Ie(L, T, z);
|
|
803
803
|
};
|
|
804
|
-
}), () =>
|
|
804
|
+
}), () => x();
|
|
805
805
|
}, [
|
|
806
|
-
|
|
806
|
+
P,
|
|
807
807
|
y,
|
|
808
|
-
|
|
808
|
+
j,
|
|
809
809
|
S,
|
|
810
810
|
E,
|
|
811
811
|
b,
|
|
@@ -817,44 +817,44 @@ var vo = ne(
|
|
|
817
817
|
const u = dn(Y);
|
|
818
818
|
if (!u) return;
|
|
819
819
|
fe.current = u;
|
|
820
|
-
const
|
|
821
|
-
|
|
820
|
+
const x = () => {
|
|
821
|
+
w.current = !1;
|
|
822
822
|
}, L = () => {
|
|
823
|
-
if (!e || !
|
|
823
|
+
if (!e || !w.current) return;
|
|
824
824
|
const { activeId: z } = e.getState();
|
|
825
|
-
z !== null && z !== M.current && (
|
|
825
|
+
z !== null && z !== M.current && (w.current = !1);
|
|
826
826
|
}, T = { passive: !0, capture: !0 };
|
|
827
|
-
return u.addEventListener("wheel",
|
|
828
|
-
u.removeEventListener("wheel",
|
|
827
|
+
return u.addEventListener("wheel", x, T), u.addEventListener("touchmove", x, T), u.addEventListener("scroll", L, T), () => {
|
|
828
|
+
u.removeEventListener("wheel", x, !0), u.removeEventListener("touchmove", x, !0), u.removeEventListener("scroll", L, !0);
|
|
829
829
|
};
|
|
830
830
|
}, [q, Y, e]), Ve(() => {
|
|
831
|
-
h && (
|
|
831
|
+
h && (B.current || (w.current = !0));
|
|
832
832
|
}, [h]), Ve(() => {
|
|
833
|
-
b !== "always" && q || (
|
|
833
|
+
b !== "always" && q || (w.current = q);
|
|
834
834
|
}, [b, q]);
|
|
835
835
|
const ve = e.useState("resetValueOnSelect");
|
|
836
836
|
Me(() => {
|
|
837
|
-
var u,
|
|
838
|
-
const L =
|
|
837
|
+
var u, x;
|
|
838
|
+
const L = w.current;
|
|
839
839
|
if (!e || !q || !L && !ve) return;
|
|
840
840
|
const { baseElement: T, contentElement: z, activeId: te } = e.getState();
|
|
841
841
|
if (!(T && !_e(T))) {
|
|
842
842
|
if (z != null && z.hasAttribute("data-placing")) {
|
|
843
|
-
const
|
|
844
|
-
return
|
|
843
|
+
const F = new MutationObserver(_);
|
|
844
|
+
return F.observe(z, { attributeFilter: ["data-placing"] }), () => F.disconnect();
|
|
845
845
|
}
|
|
846
846
|
if (b && L) {
|
|
847
|
-
const
|
|
847
|
+
const F = ue(E), ce = F !== void 0 ? F : (u = fo(E)) != null ? u : e.first();
|
|
848
848
|
M.current = ce, e.move(ce ?? null);
|
|
849
849
|
} else {
|
|
850
|
-
const
|
|
851
|
-
|
|
850
|
+
const F = (x = e.item(te || e.first())) == null ? void 0 : x.element;
|
|
851
|
+
F && "scrollIntoView" in F && F.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
}, [
|
|
855
855
|
e,
|
|
856
856
|
q,
|
|
857
|
-
|
|
857
|
+
P,
|
|
858
858
|
h,
|
|
859
859
|
b,
|
|
860
860
|
ve,
|
|
@@ -862,52 +862,52 @@ var vo = ne(
|
|
|
862
862
|
E
|
|
863
863
|
]), ae(() => {
|
|
864
864
|
if (!y) return;
|
|
865
|
-
const u =
|
|
865
|
+
const u = K.current;
|
|
866
866
|
if (!u) return;
|
|
867
|
-
const
|
|
867
|
+
const x = [u, Y].filter(
|
|
868
868
|
(T) => !!T
|
|
869
869
|
), L = (T) => {
|
|
870
|
-
|
|
870
|
+
x.every((z) => fn(T, z)) && (e == null || e.setValue(ee));
|
|
871
871
|
};
|
|
872
|
-
for (const T of
|
|
872
|
+
for (const T of x)
|
|
873
873
|
T.addEventListener("focusout", L);
|
|
874
874
|
return () => {
|
|
875
|
-
for (const T of
|
|
875
|
+
for (const T of x)
|
|
876
876
|
T.removeEventListener("focusout", L);
|
|
877
877
|
};
|
|
878
878
|
}, [y, Y, e, ee]);
|
|
879
|
-
const pe = (u) => u.currentTarget.value.length >=
|
|
879
|
+
const pe = (u) => u.currentTarget.value.length >= f, Se = g.onChange, Le = H(c ?? pe), Te = H(
|
|
880
880
|
// If the combobox is combined with tags, the value will be set by the tag
|
|
881
881
|
// input component.
|
|
882
882
|
m ?? !e.tag
|
|
883
883
|
), Re = Q((u) => {
|
|
884
884
|
if (Se == null || Se(u), u.defaultPrevented || !e) return;
|
|
885
|
-
const
|
|
886
|
-
if (
|
|
887
|
-
const
|
|
888
|
-
|
|
885
|
+
const x = u.currentTarget, { value: L, selectionStart: T, selectionEnd: z } = x, te = u.nativeEvent;
|
|
886
|
+
if (w.current = !0, co(te) && (te.isComposing && (w.current = !1, B.current = !0), y)) {
|
|
887
|
+
const F = te.inputType === "insertText" || te.inputType === "insertCompositionText", ce = T === L.length;
|
|
888
|
+
W(F && ce);
|
|
889
889
|
}
|
|
890
890
|
if (Te(u)) {
|
|
891
|
-
const
|
|
891
|
+
const F = L === e.getState().value;
|
|
892
892
|
e.setValue(L), queueMicrotask(() => {
|
|
893
|
-
Ie(
|
|
894
|
-
}), y && b &&
|
|
893
|
+
Ie(x, T, z);
|
|
894
|
+
}), y && b && F && _();
|
|
895
895
|
}
|
|
896
|
-
Le(u) && e.show(), (!b || !
|
|
896
|
+
Le(u) && e.show(), (!b || !w.current) && e.setActiveId(null);
|
|
897
897
|
}), xe = g.onCompositionEnd, Ee = Q((u) => {
|
|
898
|
-
|
|
899
|
-
}), Ke = g.onMouseDown, kt =
|
|
898
|
+
w.current = !0, B.current = !1, xe == null || xe(u), !u.defaultPrevented && b && _();
|
|
899
|
+
}), Ke = g.onMouseDown, kt = H(
|
|
900
900
|
d ?? (() => !!(e != null && e.getState().includesBaseElement))
|
|
901
|
-
), Mt =
|
|
901
|
+
), Mt = H(p), Nt = H(s ?? pe), Dt = Q((u) => {
|
|
902
902
|
Ke == null || Ke(u), !u.defaultPrevented && (u.button || u.ctrlKey || e && (kt(u) && e.setActiveId(null), Mt(u) && e.setValue(ee), Nt(u) && et(u.currentTarget, "mouseup", e.show)));
|
|
903
|
-
}), He = g.onKeyDown, Lt =
|
|
904
|
-
if (He == null || He(u), u.repeat || (
|
|
905
|
-
const { open:
|
|
906
|
-
|
|
903
|
+
}), He = g.onKeyDown, Lt = H(C ?? pe), Tt = Q((u) => {
|
|
904
|
+
if (He == null || He(u), u.repeat || (w.current = !1), u.defaultPrevented || u.ctrlKey || u.altKey || u.shiftKey || u.metaKey || !e) return;
|
|
905
|
+
const { open: x } = e.getState();
|
|
906
|
+
x || (u.key === "ArrowUp" || u.key === "ArrowDown") && Lt(u) && (u.preventDefault(), e.show());
|
|
907
907
|
}), Ue = g.onBlur, Rt = Q((u) => {
|
|
908
|
-
|
|
908
|
+
w.current = !1, Ue == null || Ue(u), u.defaultPrevented;
|
|
909
909
|
}), Kt = Ae(g.id), Ht = mo(O) ? O : void 0, Ut = e.useState((u) => u.activeId === null);
|
|
910
|
-
return g =
|
|
910
|
+
return g = U(A({
|
|
911
911
|
id: Kt,
|
|
912
912
|
role: "combobox",
|
|
913
913
|
"aria-autocomplete": Ht,
|
|
@@ -917,19 +917,19 @@ var vo = ne(
|
|
|
917
917
|
"data-active-item": Ut || void 0,
|
|
918
918
|
value: ee
|
|
919
919
|
}, g), {
|
|
920
|
-
ref: ye(
|
|
920
|
+
ref: ye(K, g.ref),
|
|
921
921
|
onChange: Re,
|
|
922
922
|
onCompositionEnd: Ee,
|
|
923
923
|
onMouseDown: Dt,
|
|
924
924
|
onKeyDown: Tt,
|
|
925
925
|
onBlur: Rt
|
|
926
|
-
}), g = At(
|
|
926
|
+
}), g = At(U(A({
|
|
927
927
|
store: e,
|
|
928
928
|
focusable: r
|
|
929
929
|
}, g), {
|
|
930
930
|
// Enable inline autocomplete when the user moves from the combobox input
|
|
931
931
|
// to an item.
|
|
932
|
-
moveOnKeyPress: (u) => mn(V, u) ? !1 : (y &&
|
|
932
|
+
moveOnKeyPress: (u) => mn(V, u) ? !1 : (y && W(!0), !0)
|
|
933
933
|
})), g = gn(A({ store: e }, g)), A({ autoComplete: "off" }, g);
|
|
934
934
|
}
|
|
935
935
|
), po = re(function(n) {
|
|
@@ -938,7 +938,7 @@ var vo = ne(
|
|
|
938
938
|
});
|
|
939
939
|
function bo(t = {}) {
|
|
940
940
|
const n = io(t);
|
|
941
|
-
return /* @__PURE__ */
|
|
941
|
+
return /* @__PURE__ */ I(yn, { value: n, children: t.children });
|
|
942
942
|
}
|
|
943
943
|
var ho = "div";
|
|
944
944
|
function So(t, n) {
|
|
@@ -961,11 +961,11 @@ var Co = ne(
|
|
|
961
961
|
hideOnClick: l,
|
|
962
962
|
setValueOnClick: a,
|
|
963
963
|
selectValueOnClick: m = !0,
|
|
964
|
-
resetValueOnSelect:
|
|
964
|
+
resetValueOnSelect: f,
|
|
965
965
|
focusOnHover: c = !1,
|
|
966
966
|
moveOnKeyPress: i = !0,
|
|
967
967
|
getItem: s
|
|
968
|
-
} = o,
|
|
968
|
+
} = o, v = oe(o, [
|
|
969
969
|
"store",
|
|
970
970
|
"value",
|
|
971
971
|
"hideOnClick",
|
|
@@ -991,51 +991,51 @@ var Co = ne(
|
|
|
991
991
|
}
|
|
992
992
|
}), g = Xe(
|
|
993
993
|
(h) => {
|
|
994
|
-
const
|
|
995
|
-
return s ? s(
|
|
994
|
+
const k = U(A({}, h), { value: r });
|
|
995
|
+
return s ? s(k) : k;
|
|
996
996
|
},
|
|
997
997
|
[r, s]
|
|
998
998
|
);
|
|
999
999
|
a = a ?? !V, l = l ?? (r != null && !V);
|
|
1000
|
-
const
|
|
1001
|
-
(C =
|
|
1002
|
-
),
|
|
1003
|
-
|
|
1004
|
-
}), b =
|
|
1000
|
+
const R = v.onClick, K = H(a), P = H(m), _ = H(
|
|
1001
|
+
(C = f ?? p) != null ? C : V
|
|
1002
|
+
), w = H(l), B = Q((h) => {
|
|
1003
|
+
R == null || R(h), !h.defaultPrevented && (ot(h) || rt(h) || (r != null && (P(h) && (_(h) && (e == null || e.resetValue()), e == null || e.setSelectedValue((k) => Array.isArray(k) ? k.includes(r) ? k.filter((S) => S !== r) : [...k, r] : r)), K(h) && (e == null || e.setValue(r))), w(h) && (e == null || e.hide())));
|
|
1004
|
+
}), b = v.onKeyDown, y = Q((h) => {
|
|
1005
1005
|
if (b == null || b(h), h.defaultPrevented) return;
|
|
1006
|
-
const
|
|
1007
|
-
if (!
|
|
1008
|
-
(h.key.length === 1 || h.key === "Backspace" || h.key === "Delete") && (queueMicrotask(() =>
|
|
1006
|
+
const k = e == null ? void 0 : e.getState().baseElement;
|
|
1007
|
+
if (!k || _e(k)) return;
|
|
1008
|
+
(h.key.length === 1 || h.key === "Backspace" || h.key === "Delete") && (queueMicrotask(() => k.focus()), pn(k) && (e == null || e.setValue(k.value)));
|
|
1009
1009
|
});
|
|
1010
|
-
V && O != null && (
|
|
1010
|
+
V && O != null && (v = A({
|
|
1011
1011
|
"aria-selected": O
|
|
1012
|
-
},
|
|
1013
|
-
|
|
1014
|
-
(h) => /* @__PURE__ */
|
|
1012
|
+
}, v)), v = he(
|
|
1013
|
+
v,
|
|
1014
|
+
(h) => /* @__PURE__ */ I(An.Provider, { value: r, children: /* @__PURE__ */ I(xn.Provider, { value: O ?? !1, children: h }) }),
|
|
1015
1015
|
[r, O]
|
|
1016
1016
|
);
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
role: go(
|
|
1017
|
+
const j = Pe(gt);
|
|
1018
|
+
v = U(A({
|
|
1019
|
+
role: go(j),
|
|
1020
1020
|
children: r
|
|
1021
|
-
},
|
|
1022
|
-
onClick:
|
|
1021
|
+
}, v), {
|
|
1022
|
+
onClick: B,
|
|
1023
1023
|
onKeyDown: y
|
|
1024
1024
|
});
|
|
1025
|
-
const
|
|
1026
|
-
return
|
|
1025
|
+
const W = H(i);
|
|
1026
|
+
return v = It(U(A({
|
|
1027
1027
|
store: e
|
|
1028
|
-
},
|
|
1028
|
+
}, v), {
|
|
1029
1029
|
getItem: g,
|
|
1030
1030
|
// Dispatch a custom event on the combobox input when moving to an item
|
|
1031
1031
|
// with the keyboard so the Combobox component can enable inline
|
|
1032
1032
|
// autocompletion.
|
|
1033
1033
|
moveOnKeyPress: (h) => {
|
|
1034
|
-
if (!
|
|
1035
|
-
const
|
|
1036
|
-
return S == null || S.dispatchEvent(
|
|
1034
|
+
if (!W(h)) return !1;
|
|
1035
|
+
const k = new Event("combobox-item-move"), S = e == null ? void 0 : e.getState().baseElement;
|
|
1036
|
+
return S == null || S.dispatchEvent(k), !0;
|
|
1037
1037
|
}
|
|
1038
|
-
})),
|
|
1038
|
+
})), v = xt(A({ store: e, focusOnHover: c }, v)), v;
|
|
1039
1039
|
}
|
|
1040
1040
|
), Eo = nt(
|
|
1041
1041
|
re(function(n) {
|
|
@@ -1047,40 +1047,40 @@ var Co = ne(
|
|
|
1047
1047
|
var o = n, { store: e, alwaysVisible: r } = o, l = oe(o, ["store", "alwaysVisible"]);
|
|
1048
1048
|
const a = St(!0), m = In();
|
|
1049
1049
|
e = e || m;
|
|
1050
|
-
const
|
|
1050
|
+
const f = !!e && e === a;
|
|
1051
1051
|
me(
|
|
1052
1052
|
e,
|
|
1053
1053
|
process.env.NODE_ENV !== "production" && "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
1054
1054
|
);
|
|
1055
|
-
const c = se(null), i = Ae(l.id), s = e.useState("mounted"),
|
|
1056
|
-
(
|
|
1057
|
-
), p = lt(c, "role", l.role), O = (p === "listbox" || p === "tree" || p === "grid") && d || void 0, [g,
|
|
1055
|
+
const c = se(null), i = Ae(l.id), s = e.useState("mounted"), v = yt(s, l.hidden, r), C = v ? U(A({}, l.style), { display: "none" }) : l.style, d = e.useState(
|
|
1056
|
+
(_) => Array.isArray(_.selectedValue)
|
|
1057
|
+
), p = lt(c, "role", l.role), O = (p === "listbox" || p === "tree" || p === "grid") && d || void 0, [g, R] = de(!1), K = e.useState("contentElement");
|
|
1058
1058
|
Ve(() => {
|
|
1059
1059
|
if (!s) return;
|
|
1060
|
-
const
|
|
1061
|
-
if (!
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
},
|
|
1065
|
-
return
|
|
1060
|
+
const _ = c.current;
|
|
1061
|
+
if (!_ || K !== _) return;
|
|
1062
|
+
const w = () => {
|
|
1063
|
+
R(!!_.querySelector("[role='listbox']"));
|
|
1064
|
+
}, B = new MutationObserver(w);
|
|
1065
|
+
return B.observe(_, {
|
|
1066
1066
|
subtree: !0,
|
|
1067
1067
|
childList: !0,
|
|
1068
1068
|
attributeFilter: ["role"]
|
|
1069
|
-
}),
|
|
1070
|
-
}, [s,
|
|
1069
|
+
}), w(), () => B.disconnect();
|
|
1070
|
+
}, [s, K]), g || (l = A({
|
|
1071
1071
|
role: "listbox",
|
|
1072
1072
|
"aria-multiselectable": O
|
|
1073
1073
|
}, l)), l = he(
|
|
1074
1074
|
l,
|
|
1075
|
-
(
|
|
1075
|
+
(_) => /* @__PURE__ */ I(wn, { value: e, children: /* @__PURE__ */ I(gt.Provider, { value: p, children: _ }) }),
|
|
1076
1076
|
[e, p]
|
|
1077
1077
|
);
|
|
1078
|
-
const
|
|
1079
|
-
return l =
|
|
1078
|
+
const P = i && (!a || !f) ? e.setContentElement : null;
|
|
1079
|
+
return l = U(A({
|
|
1080
1080
|
id: i,
|
|
1081
|
-
hidden:
|
|
1081
|
+
hidden: v
|
|
1082
1082
|
}, l), {
|
|
1083
|
-
ref: ye(
|
|
1083
|
+
ref: ye(P, c, l.ref),
|
|
1084
1084
|
style: C
|
|
1085
1085
|
}), Ge(l);
|
|
1086
1086
|
}
|
|
@@ -1598,7 +1598,7 @@ const Po = /* @__PURE__ */ Yt(wo);
|
|
|
1598
1598
|
* @copyright (c) 2020 Kent C. Dodds
|
|
1599
1599
|
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
1600
1600
|
*/
|
|
1601
|
-
const
|
|
1601
|
+
const Z = {
|
|
1602
1602
|
CASE_SENSITIVE_EQUAL: 7,
|
|
1603
1603
|
EQUAL: 6,
|
|
1604
1604
|
STARTS_WITH: 5,
|
|
@@ -1612,29 +1612,29 @@ function _t(t, n, o) {
|
|
|
1612
1612
|
o === void 0 && (o = {});
|
|
1613
1613
|
const {
|
|
1614
1614
|
keys: e,
|
|
1615
|
-
threshold: r =
|
|
1615
|
+
threshold: r = Z.MATCHES,
|
|
1616
1616
|
baseSort: l = Vo,
|
|
1617
1617
|
sorter: a = (c) => c.sort((i, s) => No(i, s, l))
|
|
1618
|
-
} = o, m = t.reduce(
|
|
1618
|
+
} = o, m = t.reduce(f, []);
|
|
1619
1619
|
return a(m).map((c) => {
|
|
1620
1620
|
let {
|
|
1621
1621
|
item: i
|
|
1622
1622
|
} = c;
|
|
1623
1623
|
return i;
|
|
1624
1624
|
});
|
|
1625
|
-
function
|
|
1626
|
-
const
|
|
1625
|
+
function f(c, i, s) {
|
|
1626
|
+
const v = _o(i, e, n, o), {
|
|
1627
1627
|
rank: C,
|
|
1628
1628
|
keyThreshold: d = r
|
|
1629
|
-
} =
|
|
1629
|
+
} = v;
|
|
1630
1630
|
return C >= d && c.push({
|
|
1631
|
-
...
|
|
1631
|
+
...v,
|
|
1632
1632
|
item: i,
|
|
1633
1633
|
index: s
|
|
1634
1634
|
}), c;
|
|
1635
1635
|
}
|
|
1636
1636
|
}
|
|
1637
|
-
_t.rankings =
|
|
1637
|
+
_t.rankings = Z;
|
|
1638
1638
|
function _o(t, n, o, e) {
|
|
1639
1639
|
if (!n) {
|
|
1640
1640
|
const l = t;
|
|
@@ -1648,34 +1648,34 @@ function _o(t, n, o, e) {
|
|
|
1648
1648
|
}
|
|
1649
1649
|
return To(t, n).reduce((l, a, m) => {
|
|
1650
1650
|
let {
|
|
1651
|
-
rank:
|
|
1651
|
+
rank: f,
|
|
1652
1652
|
rankedValue: c,
|
|
1653
1653
|
keyIndex: i,
|
|
1654
1654
|
keyThreshold: s
|
|
1655
1655
|
} = l, {
|
|
1656
|
-
itemValue:
|
|
1656
|
+
itemValue: v,
|
|
1657
1657
|
attributes: C
|
|
1658
|
-
} = a, d = Ye(
|
|
1658
|
+
} = a, d = Ye(v, o, e), p = c;
|
|
1659
1659
|
const {
|
|
1660
1660
|
minRanking: V,
|
|
1661
1661
|
maxRanking: O,
|
|
1662
1662
|
threshold: g
|
|
1663
1663
|
} = C;
|
|
1664
|
-
return d < V && d >=
|
|
1664
|
+
return d < V && d >= Z.MATCHES ? d = V : d > O && (d = O), d > f && (f = d, i = m, s = g, p = v), {
|
|
1665
1665
|
rankedValue: p,
|
|
1666
|
-
rank:
|
|
1666
|
+
rank: f,
|
|
1667
1667
|
keyIndex: i,
|
|
1668
1668
|
keyThreshold: s
|
|
1669
1669
|
};
|
|
1670
1670
|
}, {
|
|
1671
1671
|
rankedValue: t,
|
|
1672
|
-
rank:
|
|
1672
|
+
rank: Z.NO_MATCH,
|
|
1673
1673
|
keyIndex: -1,
|
|
1674
1674
|
keyThreshold: e.threshold
|
|
1675
1675
|
});
|
|
1676
1676
|
}
|
|
1677
1677
|
function Ye(t, n, o) {
|
|
1678
|
-
return t = ze(t, o), n = ze(n, o), n.length > t.length ?
|
|
1678
|
+
return t = ze(t, o), n = ze(n, o), n.length > t.length ? Z.NO_MATCH : t === n ? Z.CASE_SENSITIVE_EQUAL : (t = t.toLowerCase(), n = n.toLowerCase(), t === n ? Z.EQUAL : t.startsWith(n) ? Z.STARTS_WITH : t.includes(` ${n}`) ? Z.WORD_STARTS_WITH : t.includes(n) ? Z.CONTAINS : n.length === 1 ? Z.NO_MATCH : ko(t).includes(n) ? Z.ACRONYM : Mo(t, n));
|
|
1679
1679
|
}
|
|
1680
1680
|
function ko(t) {
|
|
1681
1681
|
let n = "";
|
|
@@ -1687,24 +1687,24 @@ function ko(t) {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
function Mo(t, n) {
|
|
1689
1689
|
let o = 0, e = 0;
|
|
1690
|
-
function r(
|
|
1691
|
-
for (let s = i,
|
|
1692
|
-
if (c[s] ===
|
|
1690
|
+
function r(f, c, i) {
|
|
1691
|
+
for (let s = i, v = c.length; s < v; s++)
|
|
1692
|
+
if (c[s] === f)
|
|
1693
1693
|
return o += 1, s + 1;
|
|
1694
1694
|
return -1;
|
|
1695
1695
|
}
|
|
1696
|
-
function l(
|
|
1697
|
-
const c = 1 /
|
|
1698
|
-
return
|
|
1696
|
+
function l(f) {
|
|
1697
|
+
const c = 1 / f, i = o / n.length;
|
|
1698
|
+
return Z.MATCHES + i * c;
|
|
1699
1699
|
}
|
|
1700
1700
|
const a = r(n[0], t, 0);
|
|
1701
1701
|
if (a < 0)
|
|
1702
|
-
return
|
|
1702
|
+
return Z.NO_MATCH;
|
|
1703
1703
|
e = a;
|
|
1704
|
-
for (let
|
|
1705
|
-
const i = n[
|
|
1704
|
+
for (let f = 1, c = n.length; f < c; f++) {
|
|
1705
|
+
const i = n[f];
|
|
1706
1706
|
if (e = r(i, t, e), !(e > -1))
|
|
1707
|
-
return
|
|
1707
|
+
return Z.NO_MATCH;
|
|
1708
1708
|
}
|
|
1709
1709
|
const m = e - a;
|
|
1710
1710
|
return l(m);
|
|
@@ -1715,9 +1715,9 @@ function No(t, n, o) {
|
|
|
1715
1715
|
keyIndex: a
|
|
1716
1716
|
} = t, {
|
|
1717
1717
|
rank: m,
|
|
1718
|
-
keyIndex:
|
|
1718
|
+
keyIndex: f
|
|
1719
1719
|
} = n;
|
|
1720
|
-
return l === m ? a ===
|
|
1720
|
+
return l === m ? a === f ? o(t, n) : a < f ? -1 : 1 : l > m ? -1 : 1;
|
|
1721
1721
|
}
|
|
1722
1722
|
function ze(t, n) {
|
|
1723
1723
|
let {
|
|
@@ -1747,8 +1747,8 @@ function Lo(t, n) {
|
|
|
1747
1747
|
for (let r = 0, l = o.length; r < l; r++) {
|
|
1748
1748
|
const a = o[r];
|
|
1749
1749
|
let m = [];
|
|
1750
|
-
for (let
|
|
1751
|
-
const i = e[
|
|
1750
|
+
for (let f = 0, c = e.length; f < c; f++) {
|
|
1751
|
+
const i = e[f];
|
|
1752
1752
|
if (i != null)
|
|
1753
1753
|
if (Object.hasOwnProperty.call(i, a)) {
|
|
1754
1754
|
const s = i[a];
|
|
@@ -1763,9 +1763,9 @@ function To(t, n) {
|
|
|
1763
1763
|
const o = [];
|
|
1764
1764
|
for (let e = 0, r = n.length; e < r; e++) {
|
|
1765
1765
|
const l = n[e], a = Ro(l), m = Do(t, l);
|
|
1766
|
-
for (let
|
|
1766
|
+
for (let f = 0, c = m.length; f < c; f++)
|
|
1767
1767
|
o.push({
|
|
1768
|
-
itemValue: m[
|
|
1768
|
+
itemValue: m[f],
|
|
1769
1769
|
attributes: a
|
|
1770
1770
|
});
|
|
1771
1771
|
}
|
|
@@ -1782,108 +1782,114 @@ function Ro(t) {
|
|
|
1782
1782
|
};
|
|
1783
1783
|
}
|
|
1784
1784
|
function cr(t) {
|
|
1785
|
-
var K;
|
|
1786
1785
|
const { baseProps: n, controlProps: o } = Qt(t, {
|
|
1787
1786
|
className: "component-select-control"
|
|
1788
1787
|
}), { prefix: e, suffix: r, ...l } = n, [a, m] = de(""), {
|
|
1789
|
-
value:
|
|
1788
|
+
value: f,
|
|
1790
1789
|
onChangeValue: c = Wt,
|
|
1791
1790
|
options: i,
|
|
1792
1791
|
placeholder: s = "Choose an option...",
|
|
1793
|
-
searchable:
|
|
1792
|
+
searchable: v = !1,
|
|
1794
1793
|
...C
|
|
1795
1794
|
} = o, d = (i || []).map(Bt), p = Ce(() => _t(d, a, {
|
|
1796
|
-
baseSort: (
|
|
1795
|
+
baseSort: (P, _) => P.index < _.index ? -1 : 1,
|
|
1797
1796
|
keys: ["label", "description"]
|
|
1798
|
-
}), [a]), V =
|
|
1799
|
-
return /* @__PURE__ */
|
|
1797
|
+
}), [a]), V = v ? Ao : Xn, O = d.find((P) => P.value === f), g = !!O, R = !g, K = g ? O.label : s;
|
|
1798
|
+
return console.log({ value: f, isPlaceholder: R }), /* @__PURE__ */ I(
|
|
1800
1799
|
bo,
|
|
1801
1800
|
{
|
|
1802
1801
|
resetValueOnHide: !0,
|
|
1803
|
-
setValue: (
|
|
1802
|
+
setValue: (P) => {
|
|
1804
1803
|
$t(() => {
|
|
1805
|
-
m(
|
|
1804
|
+
m(P);
|
|
1806
1805
|
});
|
|
1807
1806
|
},
|
|
1808
|
-
children: /* @__PURE__ */
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1807
|
+
children: /* @__PURE__ */ I(
|
|
1808
|
+
Zn,
|
|
1809
|
+
{
|
|
1810
|
+
value: R ? "" : f,
|
|
1811
|
+
setValue: c,
|
|
1812
|
+
children: /* @__PURE__ */ X(zt, { ...l, children: [
|
|
1813
|
+
/* @__PURE__ */ X(
|
|
1814
|
+
Wn,
|
|
1815
|
+
{
|
|
1816
|
+
className: "component-select-control__input",
|
|
1817
|
+
...C,
|
|
1818
|
+
children: [
|
|
1819
|
+
/* @__PURE__ */ I(
|
|
1820
|
+
"div",
|
|
1821
|
+
{
|
|
1822
|
+
className: jt(
|
|
1823
|
+
"component-select-control__value",
|
|
1824
|
+
R && "component-select-control__value--placeholder"
|
|
1825
|
+
),
|
|
1826
|
+
children: /* @__PURE__ */ I(to, { fallback: s, children: () => /* @__PURE__ */ X(we, { children: [
|
|
1827
|
+
/* @__PURE__ */ I(Fe, { children: e }),
|
|
1828
|
+
/* @__PURE__ */ I("span", { className: "component-select-control__value__label", children: K }),
|
|
1829
|
+
/* @__PURE__ */ I(Fe, { suffix: !0, children: r })
|
|
1830
|
+
] }) })
|
|
1831
|
+
}
|
|
1821
1832
|
),
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
/* @__PURE__ */ X(
|
|
1834
|
-
eo,
|
|
1835
|
-
{
|
|
1836
|
-
className: "component-select-control__popover",
|
|
1837
|
-
"data-colour-scheme": "invert",
|
|
1838
|
-
wrapperProps: {
|
|
1839
|
-
className: "component-select-control__popover__wrapper"
|
|
1840
|
-
},
|
|
1841
|
-
fitViewport: !0,
|
|
1842
|
-
gutter: 8,
|
|
1843
|
-
overflowPadding: 4,
|
|
1844
|
-
shift: -1,
|
|
1845
|
-
portal: !0,
|
|
1846
|
-
children: [
|
|
1847
|
-
/* @__PURE__ */ X(
|
|
1848
|
-
"div",
|
|
1849
|
-
{
|
|
1850
|
-
className: "component-select-control__popover__search-wrapper",
|
|
1851
|
-
inert: !f,
|
|
1852
|
-
hidden: !f,
|
|
1853
|
-
children: [
|
|
1854
|
-
/* @__PURE__ */ w(Vt, { className: "component-select-control__popover__search-icon" }),
|
|
1855
|
-
/* @__PURE__ */ w(
|
|
1856
|
-
po,
|
|
1857
|
-
{
|
|
1858
|
-
autoSelect: !0,
|
|
1859
|
-
placeholder: "Search...",
|
|
1860
|
-
className: "component-select-control__popover__search"
|
|
1861
|
-
}
|
|
1862
|
-
)
|
|
1863
|
-
]
|
|
1864
|
-
}
|
|
1865
|
-
),
|
|
1866
|
-
/* @__PURE__ */ w(V, { className: "component-select-control__list", children: p.map((x) => /* @__PURE__ */ X(
|
|
1867
|
-
zn,
|
|
1868
|
-
{
|
|
1869
|
-
disabled: x.disabled,
|
|
1870
|
-
value: x.value,
|
|
1871
|
-
className: "component-select-control__option",
|
|
1872
|
-
render: /* @__PURE__ */ w(Eo, {}),
|
|
1873
|
-
children: [
|
|
1874
|
-
/* @__PURE__ */ X("div", { className: "component-select-control__option__label", children: [
|
|
1875
|
-
x.icon,
|
|
1876
|
-
x.label
|
|
1877
|
-
] }),
|
|
1878
|
-
x.description && /* @__PURE__ */ w("div", { className: "component-select-control__option__description", children: x.description })
|
|
1879
|
-
]
|
|
1833
|
+
/* @__PURE__ */ I("div", { className: "component-select-control__caret", children: /* @__PURE__ */ I(Zt, {}) })
|
|
1834
|
+
]
|
|
1835
|
+
}
|
|
1836
|
+
),
|
|
1837
|
+
/* @__PURE__ */ X(
|
|
1838
|
+
eo,
|
|
1839
|
+
{
|
|
1840
|
+
className: "component-select-control__popover",
|
|
1841
|
+
"data-colour-scheme": "invert",
|
|
1842
|
+
wrapperProps: {
|
|
1843
|
+
className: "component-select-control__popover__wrapper"
|
|
1880
1844
|
},
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1845
|
+
fitViewport: !0,
|
|
1846
|
+
gutter: 8,
|
|
1847
|
+
overflowPadding: 4,
|
|
1848
|
+
shift: -1,
|
|
1849
|
+
portal: !0,
|
|
1850
|
+
children: [
|
|
1851
|
+
/* @__PURE__ */ X(
|
|
1852
|
+
"div",
|
|
1853
|
+
{
|
|
1854
|
+
className: "component-select-control__popover__search-wrapper",
|
|
1855
|
+
inert: !v,
|
|
1856
|
+
hidden: !v,
|
|
1857
|
+
children: [
|
|
1858
|
+
/* @__PURE__ */ I(Vt, { className: "component-select-control__popover__search-icon" }),
|
|
1859
|
+
/* @__PURE__ */ I(
|
|
1860
|
+
po,
|
|
1861
|
+
{
|
|
1862
|
+
autoSelect: !0,
|
|
1863
|
+
placeholder: "Search...",
|
|
1864
|
+
className: "component-select-control__popover__search"
|
|
1865
|
+
}
|
|
1866
|
+
)
|
|
1867
|
+
]
|
|
1868
|
+
}
|
|
1869
|
+
),
|
|
1870
|
+
/* @__PURE__ */ I(V, { className: "component-select-control__list", children: p.map((P) => /* @__PURE__ */ X(
|
|
1871
|
+
zn,
|
|
1872
|
+
{
|
|
1873
|
+
disabled: P.disabled,
|
|
1874
|
+
value: P.value,
|
|
1875
|
+
className: "component-select-control__option",
|
|
1876
|
+
render: /* @__PURE__ */ I(Eo, {}),
|
|
1877
|
+
children: [
|
|
1878
|
+
/* @__PURE__ */ X("div", { className: "component-select-control__option__label", children: [
|
|
1879
|
+
P.icon,
|
|
1880
|
+
P.label
|
|
1881
|
+
] }),
|
|
1882
|
+
P.description && /* @__PURE__ */ I("div", { className: "component-select-control__option__description", children: P.description })
|
|
1883
|
+
]
|
|
1884
|
+
},
|
|
1885
|
+
P.value
|
|
1886
|
+
)) })
|
|
1887
|
+
]
|
|
1888
|
+
}
|
|
1889
|
+
)
|
|
1890
|
+
] })
|
|
1891
|
+
}
|
|
1892
|
+
)
|
|
1887
1893
|
}
|
|
1888
1894
|
);
|
|
1889
1895
|
}
|