@telegraph/combobox 0.0.2 → 0.0.3
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/CHANGELOG.md +6 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +81 -81
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
1
|
+
import { jsx as u, jsxs as T, Fragment as W } from "react/jsx-runtime";
|
|
2
2
|
import { useControllableState as be } from "@radix-ui/react-use-controllable-state";
|
|
3
3
|
import * as he from "@radix-ui/react-visually-hidden";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as Y, Lucide as j } from "@telegraph/icon";
|
|
5
5
|
import * as ye from "react";
|
|
6
6
|
import p from "react";
|
|
7
|
-
import { Text as
|
|
8
|
-
import { useComposedRefs as
|
|
7
|
+
import { Text as B } from "@telegraph/typography";
|
|
8
|
+
import { useComposedRefs as D } from "@telegraph/compose-refs";
|
|
9
9
|
import { RefToTgphRef as re } from "@telegraph/helpers";
|
|
10
10
|
import { Input as fe } from "@telegraph/input";
|
|
11
11
|
import { Menu as N } from "@telegraph/menu";
|
|
@@ -537,11 +537,11 @@ const O = ["sm", "md", "lg", "xl", "2xl"], we = (o) => {
|
|
|
537
537
|
px: "0"
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
},
|
|
540
|
+
}, Se = {
|
|
541
541
|
1: "1",
|
|
542
542
|
2: "2",
|
|
543
543
|
3: "3"
|
|
544
|
-
},
|
|
544
|
+
}, Te = {
|
|
545
545
|
solid: {
|
|
546
546
|
gray: "white",
|
|
547
547
|
red: "white",
|
|
@@ -630,7 +630,7 @@ const O = ["sm", "md", "lg", "xl", "2xl"], we = (o) => {
|
|
|
630
630
|
}, _e = {
|
|
631
631
|
default: "secondary",
|
|
632
632
|
"icon-only": "primary"
|
|
633
|
-
},
|
|
633
|
+
}, K = p.createContext({
|
|
634
634
|
variant: "solid",
|
|
635
635
|
size: "2",
|
|
636
636
|
color: "gray",
|
|
@@ -649,17 +649,17 @@ const O = ["sm", "md", "lg", "xl", "2xl"], we = (o) => {
|
|
|
649
649
|
...c
|
|
650
650
|
}) => {
|
|
651
651
|
const d = n ? "disabled" : i, s = d === "disabled" ? "disabled" : a, b = p.useMemo(() => {
|
|
652
|
-
var
|
|
652
|
+
var h;
|
|
653
653
|
const g = p.Children.toArray(c == null ? void 0 : c.children);
|
|
654
654
|
if ((g == null ? void 0 : g.length) === 1 && p.isValidElement(g[0])) {
|
|
655
|
-
const
|
|
656
|
-
if ((
|
|
655
|
+
const y = g[0];
|
|
656
|
+
if ((h = y == null ? void 0 : y.props) != null && h.icon)
|
|
657
657
|
return "icon-only";
|
|
658
658
|
}
|
|
659
659
|
return "default";
|
|
660
660
|
}, [c == null ? void 0 : c.children]);
|
|
661
661
|
return /* @__PURE__ */ u(
|
|
662
|
-
|
|
662
|
+
K.Provider,
|
|
663
663
|
{
|
|
664
664
|
value: { variant: t, size: e, color: s, state: d, layout: b, active: r },
|
|
665
665
|
children: /* @__PURE__ */ u(
|
|
@@ -700,13 +700,13 @@ const O = ["sm", "md", "lg", "xl", "2xl"], we = (o) => {
|
|
|
700
700
|
"aria-hidden": r,
|
|
701
701
|
...n
|
|
702
702
|
}) => {
|
|
703
|
-
const l = p.useContext(
|
|
703
|
+
const l = p.useContext(K), c = {
|
|
704
704
|
size: o ?? Ee[l.size],
|
|
705
705
|
color: t ?? Oe[l.variant][l.color],
|
|
706
706
|
variant: e ?? _e[l.layout]
|
|
707
707
|
};
|
|
708
708
|
return /* @__PURE__ */ u(
|
|
709
|
-
|
|
709
|
+
Y,
|
|
710
710
|
{
|
|
711
711
|
icon: a,
|
|
712
712
|
"data-button-icon": !0,
|
|
@@ -723,13 +723,13 @@ const O = ["sm", "md", "lg", "xl", "2xl"], we = (o) => {
|
|
|
723
723
|
className: i,
|
|
724
724
|
...r
|
|
725
725
|
}) => {
|
|
726
|
-
const n = p.useContext(
|
|
726
|
+
const n = p.useContext(K);
|
|
727
727
|
return /* @__PURE__ */ u(
|
|
728
|
-
|
|
728
|
+
B,
|
|
729
729
|
{
|
|
730
730
|
as: o || "span",
|
|
731
|
-
color: t ??
|
|
732
|
-
size: e ??
|
|
731
|
+
color: t ?? Te[n.variant][n.color],
|
|
732
|
+
size: e ?? Se[n.size],
|
|
733
733
|
weight: a,
|
|
734
734
|
className: $("no-underline whitespace-nowrap", i),
|
|
735
735
|
internal_optionalAs: !0,
|
|
@@ -745,7 +745,7 @@ const O = ["sm", "md", "lg", "xl", "2xl"], we = (o) => {
|
|
|
745
745
|
...i
|
|
746
746
|
}) => {
|
|
747
747
|
const r = o || e;
|
|
748
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ T(ie, { ...i, children: [
|
|
749
749
|
r && /* @__PURE__ */ u(H, { ...r }),
|
|
750
750
|
a && /* @__PURE__ */ u(le, { children: a }),
|
|
751
751
|
t && /* @__PURE__ */ u(H, { ...t })
|
|
@@ -756,7 +756,7 @@ Object.assign(ce, {
|
|
|
756
756
|
Icon: H,
|
|
757
757
|
Text: le
|
|
758
758
|
});
|
|
759
|
-
const
|
|
759
|
+
const M = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
760
760
|
const t = [];
|
|
761
761
|
let e = null;
|
|
762
762
|
for (let a = 0; a < _.length; a++) {
|
|
@@ -1100,7 +1100,7 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1100
1100
|
tgphRef: e,
|
|
1101
1101
|
...a
|
|
1102
1102
|
}) => {
|
|
1103
|
-
const i = o || "div", r = p.useRef(null), n =
|
|
1103
|
+
const i = o || "div", r = p.useRef(null), n = D(e, r), l = p.useMemo(() => {
|
|
1104
1104
|
const c = { borderColor: !0, ...a };
|
|
1105
1105
|
return Object.keys(c).reduce(
|
|
1106
1106
|
(d, s) => (Object.keys(ee).some((b) => b === s) ? d.box[s] = c[s] : d.rest[s] = c[s], d),
|
|
@@ -1152,12 +1152,12 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1152
1152
|
type: "spacing",
|
|
1153
1153
|
valueType: "variable"
|
|
1154
1154
|
}
|
|
1155
|
-
},
|
|
1155
|
+
}, S = ({
|
|
1156
1156
|
className: o,
|
|
1157
1157
|
tgphRef: t,
|
|
1158
1158
|
...e
|
|
1159
1159
|
}) => {
|
|
1160
|
-
const a = p.useRef(null), i =
|
|
1160
|
+
const a = p.useRef(null), i = D(t, a), r = p.useMemo(
|
|
1161
1161
|
() => Object.keys(e).reduce(
|
|
1162
1162
|
(n, l) => (Object.keys(te).some((c) => c === l) ? n.stack[l] = e[l] : n.rest[l] = e[l], n),
|
|
1163
1163
|
{ stack: {}, rest: {} }
|
|
@@ -1201,13 +1201,13 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1201
1201
|
layout: d,
|
|
1202
1202
|
...s
|
|
1203
1203
|
}) => {
|
|
1204
|
-
const b = p.useId(),
|
|
1204
|
+
const b = p.useId(), h = p.useId(), g = p.useRef(null), y = p.useRef(null), v = p.useRef(null), [k, C] = p.useState(""), [L = !1, P] = be({
|
|
1205
1205
|
prop: e,
|
|
1206
1206
|
defaultProp: i,
|
|
1207
1207
|
onChange: a
|
|
1208
1208
|
}), de = p.useCallback(() => {
|
|
1209
|
-
|
|
1210
|
-
}, [
|
|
1209
|
+
P((ge) => !ge);
|
|
1210
|
+
}, [P]);
|
|
1211
1211
|
return p.useEffect(() => {
|
|
1212
1212
|
L || C("");
|
|
1213
1213
|
}, [L]), /* @__PURE__ */ u(
|
|
@@ -1215,18 +1215,18 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1215
1215
|
{
|
|
1216
1216
|
value: {
|
|
1217
1217
|
contentId: b,
|
|
1218
|
-
triggerId:
|
|
1218
|
+
triggerId: h,
|
|
1219
1219
|
value: r,
|
|
1220
1220
|
onValueChange: n,
|
|
1221
1221
|
placeholder: c,
|
|
1222
1222
|
open: L,
|
|
1223
|
-
setOpen:
|
|
1223
|
+
setOpen: P,
|
|
1224
1224
|
onOpenToggle: de,
|
|
1225
1225
|
closeOnSelect: t,
|
|
1226
1226
|
searchQuery: k,
|
|
1227
1227
|
setSearchQuery: C,
|
|
1228
1228
|
triggerRef: g,
|
|
1229
|
-
searchRef:
|
|
1229
|
+
searchRef: y,
|
|
1230
1230
|
contentRef: v,
|
|
1231
1231
|
errored: l,
|
|
1232
1232
|
layout: d
|
|
@@ -1235,16 +1235,16 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1235
1235
|
N.Root,
|
|
1236
1236
|
{
|
|
1237
1237
|
open: L,
|
|
1238
|
-
onOpenChange:
|
|
1238
|
+
onOpenChange: P,
|
|
1239
1239
|
modal: o,
|
|
1240
1240
|
...s
|
|
1241
1241
|
}
|
|
1242
1242
|
)
|
|
1243
1243
|
}
|
|
1244
1244
|
);
|
|
1245
|
-
},
|
|
1245
|
+
}, Me = ({ label: o, value: t, ...e }) => {
|
|
1246
1246
|
const a = p.useContext(w);
|
|
1247
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ T(
|
|
1248
1248
|
z.Root,
|
|
1249
1249
|
{
|
|
1250
1250
|
size: "1",
|
|
@@ -1279,15 +1279,15 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1279
1279
|
]
|
|
1280
1280
|
}
|
|
1281
1281
|
);
|
|
1282
|
-
},
|
|
1282
|
+
}, Pe = ({
|
|
1283
1283
|
size: o = "1"
|
|
1284
1284
|
}) => {
|
|
1285
1285
|
var a, i;
|
|
1286
1286
|
const t = p.useContext(w), e = o === "1" ? "6" : o === "2" ? "8" : "10";
|
|
1287
1287
|
if (t.value && Q(t.value)) {
|
|
1288
1288
|
const r = t.value, n = t.layout || "truncate", l = r.length - 2, c = l.toString().split("");
|
|
1289
|
-
return r.length === 0 ? /* @__PURE__ */ u(
|
|
1290
|
-
|
|
1289
|
+
return r.length === 0 ? /* @__PURE__ */ u(S, { h: e, align: "center", my: "1", children: /* @__PURE__ */ u(M.Text, { color: "gray", children: t.placeholder }) }) : /* @__PURE__ */ T(
|
|
1290
|
+
S,
|
|
1291
1291
|
{
|
|
1292
1292
|
gap: "1",
|
|
1293
1293
|
w: "full",
|
|
@@ -1301,10 +1301,10 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1301
1301
|
children: [
|
|
1302
1302
|
/* @__PURE__ */ u(F, { initial: !1, mode: "popLayout", children: r.map((d, s) => {
|
|
1303
1303
|
if (n === "truncate" && s <= 1 || n === "wrap")
|
|
1304
|
-
return /* @__PURE__ */ u(re, { children: /* @__PURE__ */ u(
|
|
1304
|
+
return /* @__PURE__ */ u(re, { children: /* @__PURE__ */ u(Me, { ...d }) }, d.value);
|
|
1305
1305
|
}) }),
|
|
1306
1306
|
/* @__PURE__ */ u(F, { children: n === "truncate" && r.length > 2 && /* @__PURE__ */ u(
|
|
1307
|
-
|
|
1307
|
+
S,
|
|
1308
1308
|
{
|
|
1309
1309
|
as: E.div,
|
|
1310
1310
|
initial: { opacity: 0 },
|
|
@@ -1321,7 +1321,7 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1321
1321
|
right: 0,
|
|
1322
1322
|
backgroundImage: "linear-gradient(to left, var(--tgph-surface-1) 0 60%, transparent 90% 100%)"
|
|
1323
1323
|
},
|
|
1324
|
-
children: /* @__PURE__ */
|
|
1324
|
+
children: /* @__PURE__ */ T(B, { as: "span", size: "1", style: { whiteSpace: "nowrap" }, children: [
|
|
1325
1325
|
"+",
|
|
1326
1326
|
/* @__PURE__ */ u(F, { mode: "wait", initial: !1, children: c.map((d) => /* @__PURE__ */ u(
|
|
1327
1327
|
X,
|
|
@@ -1353,8 +1353,8 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
);
|
|
1355
1355
|
}
|
|
1356
|
-
return /* @__PURE__ */ u(
|
|
1357
|
-
},
|
|
1356
|
+
return /* @__PURE__ */ u(S, { h: e, align: "center", my: "1", children: /* @__PURE__ */ u(M.Text, { color: t.value ? "default" : "gray", children: ((a = t == null ? void 0 : t.value) == null ? void 0 : a.label) || ((i = t == null ? void 0 : t.value) == null ? void 0 : i.value) || t.placeholder }) });
|
|
1357
|
+
}, Be = ({ size: o = "1", ...t }) => {
|
|
1358
1358
|
const e = p.useContext(w), a = p.useCallback(() => {
|
|
1359
1359
|
var i, r, n;
|
|
1360
1360
|
return e.value ? q(e.value) ? ((i = e.value) == null ? void 0 : i.label) || ((r = e.value) == null ? void 0 : r.value) || e.placeholder : ((n = e.value) == null ? void 0 : n.map((l) => l.label).join(", ")) || e.placeholder : e.placeholder;
|
|
@@ -1383,8 +1383,8 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
},
|
|
1385
1385
|
tgphRef: e.triggerRef,
|
|
1386
|
-
children: /* @__PURE__ */ u(re, { children: /* @__PURE__ */
|
|
1387
|
-
|
|
1386
|
+
children: /* @__PURE__ */ u(re, { children: /* @__PURE__ */ T(
|
|
1387
|
+
M.Root,
|
|
1388
1388
|
{
|
|
1389
1389
|
id: e.triggerId,
|
|
1390
1390
|
bg: "surface-1",
|
|
@@ -1401,9 +1401,9 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1401
1401
|
"data-tgph-combobox-trigger": !0,
|
|
1402
1402
|
"data-tgph-comobox-trigger-open": e.open,
|
|
1403
1403
|
children: [
|
|
1404
|
-
/* @__PURE__ */ u(
|
|
1404
|
+
/* @__PURE__ */ u(Pe, { size: o }),
|
|
1405
1405
|
/* @__PURE__ */ u(
|
|
1406
|
-
|
|
1406
|
+
M.Icon,
|
|
1407
1407
|
{
|
|
1408
1408
|
as: E.div,
|
|
1409
1409
|
icon: j.ChevronDown,
|
|
@@ -1417,28 +1417,28 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1417
1417
|
) })
|
|
1418
1418
|
}
|
|
1419
1419
|
);
|
|
1420
|
-
},
|
|
1420
|
+
}, De = ({
|
|
1421
1421
|
tgphRef: o,
|
|
1422
1422
|
style: t,
|
|
1423
1423
|
children: e,
|
|
1424
1424
|
...a
|
|
1425
1425
|
}) => {
|
|
1426
|
-
const i = p.useContext(w), r = p.useRef(!1), n =
|
|
1426
|
+
const i = p.useContext(w), r = p.useRef(!1), n = D(o, i.contentRef), l = p.useRef(null), [c, d] = p.useState(0), [s, b] = p.useState(!1), h = p.useCallback(
|
|
1427
1427
|
(g) => {
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1428
|
+
const y = g.getBoundingClientRect();
|
|
1429
|
+
y && d(y.height), s || b(!0);
|
|
1430
1430
|
},
|
|
1431
1431
|
[s]
|
|
1432
1432
|
);
|
|
1433
1433
|
return p.useEffect(() => {
|
|
1434
|
-
const g = new ResizeObserver((
|
|
1435
|
-
for (const v of
|
|
1434
|
+
const g = new ResizeObserver((y) => {
|
|
1435
|
+
for (const v of y) {
|
|
1436
1436
|
const k = v.target;
|
|
1437
|
-
|
|
1437
|
+
h(k);
|
|
1438
1438
|
}
|
|
1439
1439
|
});
|
|
1440
1440
|
return l.current && s && g.observe(l.current), () => g.disconnect();
|
|
1441
|
-
}, [s,
|
|
1441
|
+
}, [s, h]), p.useEffect(() => {
|
|
1442
1442
|
s === !0 && i.open === !1 && b(!1);
|
|
1443
1443
|
}, [i.open, s]), /* @__PURE__ */ u(
|
|
1444
1444
|
N.Content,
|
|
@@ -1465,19 +1465,19 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1465
1465
|
onAnimationComplete: () => {
|
|
1466
1466
|
if (!s && l) {
|
|
1467
1467
|
const g = l.current;
|
|
1468
|
-
|
|
1468
|
+
h(g);
|
|
1469
1469
|
}
|
|
1470
1470
|
},
|
|
1471
1471
|
onCloseAutoFocus: (g) => {
|
|
1472
|
-
var
|
|
1473
|
-
r.current || (v = (
|
|
1472
|
+
var y, v;
|
|
1473
|
+
r.current || (v = (y = i.triggerRef) == null ? void 0 : y.current) == null || v.focus(), r.current = !1, g.preventDefault();
|
|
1474
1474
|
},
|
|
1475
1475
|
onKeyDown: (g) => {
|
|
1476
1476
|
var v, k, C, L;
|
|
1477
|
-
const
|
|
1477
|
+
const y = (k = (v = i.contentRef) == null ? void 0 : v.current) == null ? void 0 : k.querySelectorAll(
|
|
1478
1478
|
"[data-tgph-combobox-option]"
|
|
1479
1479
|
);
|
|
1480
|
-
document.activeElement === (
|
|
1480
|
+
document.activeElement === (y == null ? void 0 : y[0]) && Ae.includes(g.key) && ((L = (C = i.searchRef) == null ? void 0 : C.current) == null || L.focus()), g.key === "Escape" && i.setOpen(!1), g.stopPropagation();
|
|
1481
1481
|
},
|
|
1482
1482
|
bg: "surface-1",
|
|
1483
1483
|
style: {
|
|
@@ -1495,13 +1495,13 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1495
1495
|
"data-tgph-combobox-content-open": s,
|
|
1496
1496
|
role: void 0,
|
|
1497
1497
|
"aria-orientation": void 0,
|
|
1498
|
-
children: /* @__PURE__ */ u(
|
|
1498
|
+
children: /* @__PURE__ */ u(S, { direction: "column", gap: "1", tgphRef: l, children: e })
|
|
1499
1499
|
}
|
|
1500
1500
|
);
|
|
1501
1501
|
}, Ne = ({ ...o }) => {
|
|
1502
1502
|
const t = p.useContext(w);
|
|
1503
1503
|
return /* @__PURE__ */ u(
|
|
1504
|
-
|
|
1504
|
+
S,
|
|
1505
1505
|
{
|
|
1506
1506
|
id: t.contentId,
|
|
1507
1507
|
direction: "column",
|
|
@@ -1522,11 +1522,11 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1522
1522
|
onSelect: a,
|
|
1523
1523
|
...i
|
|
1524
1524
|
}) => {
|
|
1525
|
-
const r = p.useContext(w), [n, l] = p.useState(!1), c = r.value ?? [], d = (Q(c), !r.searchQuery || o.toLowerCase().includes(r.searchQuery.toLowerCase())), s = Q(c) ? c.some((
|
|
1526
|
-
var g,
|
|
1527
|
-
if (ue.includes(
|
|
1528
|
-
if (
|
|
1529
|
-
return a(
|
|
1525
|
+
const r = p.useContext(w), [n, l] = p.useState(!1), c = r.value ?? [], d = (Q(c), !r.searchQuery || o.toLowerCase().includes(r.searchQuery.toLowerCase())), s = Q(c) ? c.some((h) => h.value === o) : c.value === o, b = (h) => {
|
|
1526
|
+
var g, y;
|
|
1527
|
+
if (!(h.key && !ue.includes(h.key))) {
|
|
1528
|
+
if (h.stopPropagation(), h.preventDefault(), r.closeOnSelect === !0 && r.setOpen(!1), a)
|
|
1529
|
+
return a(h);
|
|
1530
1530
|
if (Q(c)) {
|
|
1531
1531
|
const v = r.onValueChange, k = s ? c.filter((C) => C.value !== o) : [...c, { value: o, label: t }];
|
|
1532
1532
|
v(k);
|
|
@@ -1534,14 +1534,14 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1534
1534
|
const v = r.onValueChange;
|
|
1535
1535
|
v({ value: o, label: t });
|
|
1536
1536
|
}
|
|
1537
|
-
(
|
|
1537
|
+
(y = (g = r.triggerRef) == null ? void 0 : g.current) == null || y.focus();
|
|
1538
1538
|
}
|
|
1539
1539
|
};
|
|
1540
1540
|
if (d)
|
|
1541
1541
|
return /* @__PURE__ */ u(
|
|
1542
1542
|
N.Button,
|
|
1543
1543
|
{
|
|
1544
|
-
|
|
1544
|
+
onSelect: b,
|
|
1545
1545
|
selected: e === null ? null : e ?? s,
|
|
1546
1546
|
onFocus: () => l(!0),
|
|
1547
1547
|
onBlur: () => l(!1),
|
|
@@ -1562,19 +1562,19 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1562
1562
|
...a
|
|
1563
1563
|
}) => {
|
|
1564
1564
|
var l;
|
|
1565
|
-
const i = p.useId(), r = p.useContext(w), n =
|
|
1565
|
+
const i = p.useId(), r = p.useContext(w), n = D(e, r.searchRef);
|
|
1566
1566
|
return p.useEffect(() => {
|
|
1567
1567
|
var s;
|
|
1568
1568
|
const c = (b) => {
|
|
1569
|
-
var
|
|
1570
|
-
Ve.includes(b.key) && ((g = (
|
|
1569
|
+
var h, g;
|
|
1570
|
+
Ve.includes(b.key) && ((g = (h = r.contentRef) == null ? void 0 : h.current) == null || g.focus({ preventScroll: !0 })), b.key === "Escape" && r.setOpen(!1), b.stopPropagation();
|
|
1571
1571
|
}, d = (s = r.searchRef) == null ? void 0 : s.current;
|
|
1572
1572
|
if (d)
|
|
1573
1573
|
return d.addEventListener("keydown", c), () => {
|
|
1574
1574
|
d.removeEventListener("keydown", c);
|
|
1575
1575
|
};
|
|
1576
|
-
}, [r]), /* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */ u(he.Root, { children: /* @__PURE__ */ u(
|
|
1576
|
+
}, [r]), /* @__PURE__ */ T(X, { borderBottom: !0, px: "1", pb: "1", children: [
|
|
1577
|
+
/* @__PURE__ */ u(he.Root, { children: /* @__PURE__ */ u(B, { as: "label", htmlFor: i, children: o }) }),
|
|
1578
1578
|
/* @__PURE__ */ u(
|
|
1579
1579
|
fe,
|
|
1580
1580
|
{
|
|
@@ -1586,9 +1586,9 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1586
1586
|
var d;
|
|
1587
1587
|
(d = r == null ? void 0 : r.setSearchQuery) == null || d.call(r, c.target.value);
|
|
1588
1588
|
},
|
|
1589
|
-
LeadingComponent: /* @__PURE__ */ u(
|
|
1589
|
+
LeadingComponent: /* @__PURE__ */ u(Y, { icon: j.Search, alt: "Search Icon" }),
|
|
1590
1590
|
TrailingComponent: r != null && r.searchQuery && ((l = r == null ? void 0 : r.searchQuery) == null ? void 0 : l.length) > 0 ? /* @__PURE__ */ u(
|
|
1591
|
-
|
|
1591
|
+
M,
|
|
1592
1592
|
{
|
|
1593
1593
|
as: E.button,
|
|
1594
1594
|
initial: { opacity: 0 },
|
|
@@ -1625,8 +1625,8 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1625
1625
|
);
|
|
1626
1626
|
(l == null ? void 0 : l.length) === 0 ? n(!0) : n(!1);
|
|
1627
1627
|
}, [i.searchQuery, i.contentRef, e]), r)
|
|
1628
|
-
return /* @__PURE__ */
|
|
1629
|
-
|
|
1628
|
+
return /* @__PURE__ */ T(
|
|
1629
|
+
S,
|
|
1630
1630
|
{
|
|
1631
1631
|
as: E.div,
|
|
1632
1632
|
initial: { opacity: 0, scale: 0.8 },
|
|
@@ -1640,8 +1640,8 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1640
1640
|
"data-tgph-combobox-empty": !0,
|
|
1641
1641
|
...a,
|
|
1642
1642
|
children: [
|
|
1643
|
-
o === null ? /* @__PURE__ */ u(W, {}) : /* @__PURE__ */ u(
|
|
1644
|
-
t === null ? /* @__PURE__ */ u(W, {}) : /* @__PURE__ */ u(
|
|
1643
|
+
o === null ? /* @__PURE__ */ u(W, {}) : /* @__PURE__ */ u(Y, { ...o }),
|
|
1644
|
+
t === null ? /* @__PURE__ */ u(W, {}) : /* @__PURE__ */ u(B, { as: "span", children: t })
|
|
1645
1645
|
]
|
|
1646
1646
|
}
|
|
1647
1647
|
);
|
|
@@ -1672,11 +1672,11 @@ const D = ce, _ = ["sm", "md", "lg", "xl", "2xl"], je = (o) => {
|
|
|
1672
1672
|
...i
|
|
1673
1673
|
}
|
|
1674
1674
|
);
|
|
1675
|
-
},
|
|
1676
|
-
Object.assign(
|
|
1675
|
+
}, Ye = {};
|
|
1676
|
+
Object.assign(Ye, {
|
|
1677
1677
|
Root: Qe,
|
|
1678
|
-
Trigger:
|
|
1679
|
-
Content:
|
|
1678
|
+
Trigger: Be,
|
|
1679
|
+
Content: De,
|
|
1680
1680
|
Options: Ne,
|
|
1681
1681
|
Option: se,
|
|
1682
1682
|
Search: ze,
|
|
@@ -1684,6 +1684,6 @@ Object.assign(Ke, {
|
|
|
1684
1684
|
Create: He
|
|
1685
1685
|
});
|
|
1686
1686
|
export {
|
|
1687
|
-
|
|
1687
|
+
Ye as Combobox
|
|
1688
1688
|
};
|
|
1689
1689
|
//# sourceMappingURL=index.mjs.map
|