@telegraph/combobox 0.0.77 → 0.0.78

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,62 +1,330 @@
1
- import { jsx as p, jsxs as S, Fragment as K } from "react/jsx-runtime";
2
- import { DismissableLayer as U } from "@radix-ui/react-dismissable-layer";
3
- import * as W from "@radix-ui/react-portal";
4
- import { useControllableState as J } from "@radix-ui/react-use-controllable-state";
5
- import * as Z from "@radix-ui/react-visually-hidden";
6
- import { Button as I } from "@telegraph/button";
7
- import { useComposedRefs as j } from "@telegraph/compose-refs";
8
- import { RefToTgphRef as ee } from "@telegraph/helpers";
9
- import { Lucide as E, Icon as N } from "@telegraph/icon";
10
- import { Input as te } from "@telegraph/input";
11
- import { Stack as T, Box as _ } from "@telegraph/layout";
1
+ import { jsx as l, jsxs as R, Fragment as _ } from "react/jsx-runtime";
2
+ import { DismissableLayer as Z } from "@radix-ui/react-dismissable-layer";
3
+ import * as ee from "@radix-ui/react-portal";
4
+ import { useControllableState as te } from "@radix-ui/react-use-controllable-state";
5
+ import * as oe from "@radix-ui/react-visually-hidden";
6
+ import { Button as B } from "@telegraph/button";
7
+ import { useComposedRefs as $ } from "@telegraph/compose-refs";
8
+ import { RefToTgphRef as re } from "@telegraph/helpers";
9
+ import { Lucide as E, Icon as z } from "@telegraph/icon";
10
+ import { Input as ne } from "@telegraph/input";
11
+ import { Stack as I, Box as G } from "@telegraph/layout";
12
12
  import { Menu as Q } from "@telegraph/menu";
13
- import { motion as B, AnimatePresence as V } from "@telegraph/motion";
14
- import { Tag as L } from "@telegraph/tag";
15
- import { Tooltip as oe } from "@telegraph/tooltip";
16
- import { Text as M } from "@telegraph/typography";
13
+ import { Text as H } from "@telegraph/typography";
17
14
  import s from "react";
18
- const ne = {
15
+ import { motion as P, AnimatePresence as M } from "@telegraph/motion";
16
+ import { Tag as K } from "@telegraph/tag";
17
+ import { Tooltip as ae } from "@telegraph/tooltip";
18
+ const ie = {
19
19
  0: "5",
20
20
  1: "6",
21
21
  2: "8",
22
22
  3: "10"
23
- }, R = (e) => Array.isArray(e), k = (e) => typeof e == "object" && !Array.isArray(e) || typeof e == "string" || !e, re = (e) => {
24
- const c = (o, l = []) => (s.Children.toArray(o).forEach((n) => {
25
- s.isValidElement(n) && (n.props.value ? l.push(n) : n.props.children && c(n.props.children, l));
26
- }), l);
27
- return c(e).map((o) => {
28
- var i;
29
- const l = o;
23
+ }, S = (t) => Array.isArray(t), k = (t) => typeof t == "object" && !Array.isArray(t) || typeof t == "string" || !t, ce = (t) => {
24
+ const o = (a, c = []) => (s.Children.toArray(a).forEach((i) => {
25
+ s.isValidElement(i) && (i.props.value ? c.push(i) : i.props.children && o(i.props.children, c));
26
+ }), c);
27
+ return o(t).map((a) => {
28
+ var n;
29
+ const c = a;
30
30
  return {
31
- value: l.props.value,
32
- label: ((i = l.props) == null ? void 0 : i.label) || l.props.children || l.props.value
31
+ value: c.props.value,
32
+ label: ((n = c.props) == null ? void 0 : n.label) || c.props.children || c.props.value
33
33
  };
34
34
  });
35
- }, C = (e, c) => {
36
- if (e)
37
- return c === !0 ? e == null ? void 0 : e.value : e;
38
- }, F = (e, c, r) => {
39
- if (!e || !c || c.length === 0) return;
40
- const t = c.find(
41
- (o) => o.value === C(e, r)
42
- );
35
+ }, C = (t, o) => {
43
36
  if (t)
44
- return t;
45
- }, ae = ({
46
- children: e,
47
- value: c,
48
- searchQuery: r
37
+ return o === !0 ? t == null ? void 0 : t.value : t;
38
+ }, F = (t, o, e) => {
39
+ if (!t || !o || o.length === 0) return;
40
+ const r = o.find(
41
+ (a) => a.value === C(t, e)
42
+ );
43
+ if (r)
44
+ return r;
45
+ }, se = ({
46
+ children: t,
47
+ value: o,
48
+ searchQuery: e
49
+ }) => {
50
+ const r = Y(t);
51
+ return (o == null ? void 0 : o.toLowerCase().includes(e.toLowerCase())) || r.some(
52
+ (a) => a.toLowerCase().includes(e.toLowerCase())
53
+ );
54
+ }, Y = (t) => {
55
+ const o = s.Children.toArray(t), e = [];
56
+ return o.forEach((r) => {
57
+ typeof r == "string" && e.push(r), s.isValidElement(r) && r.props.children && e.push(...Y(r.props.children));
58
+ }), e;
59
+ }, le = ({
60
+ icon: t = E.ChevronDown,
61
+ "aria-hidden": o = !0,
62
+ ...e
63
+ }) => {
64
+ const r = s.useContext(y);
65
+ return /* @__PURE__ */ l(
66
+ B.Icon,
67
+ {
68
+ as: P.span,
69
+ animate: { rotate: r.open ? 180 : 0 },
70
+ transition: { duration: 150, type: "spring" },
71
+ icon: t,
72
+ "aria-hidden": o,
73
+ ...e
74
+ }
75
+ );
76
+ }, ue = ({
77
+ tooltipProps: t,
78
+ ...o
79
+ }) => {
80
+ const e = s.useContext(y), r = () => {
81
+ var c, n;
82
+ if (S(e.value)) {
83
+ const i = e.onValueChange;
84
+ i == null || i([]);
85
+ }
86
+ if (k(e.value)) {
87
+ const i = e.onValueChange;
88
+ i == null || i(void 0);
89
+ }
90
+ (n = (c = e.triggerRef) == null ? void 0 : c.current) == null || n.focus();
91
+ };
92
+ return s.useMemo(() => {
93
+ var c;
94
+ if (k(e.value))
95
+ return e.clearable && e.value;
96
+ if (S(e.value))
97
+ return e.clearable && ((c = e.value) == null ? void 0 : c.length) > 0;
98
+ }, [e.clearable, e.value]) ? /* @__PURE__ */ l(ae, { label: "Clear field", ...t, children: /* @__PURE__ */ l(
99
+ B,
100
+ {
101
+ type: "button",
102
+ icon: { icon: E.X, alt: "Clear field" },
103
+ size: "1",
104
+ variant: "ghost",
105
+ onClick: (c) => {
106
+ e.value && (c.stopPropagation(), r());
107
+ },
108
+ onKeyDown: (c) => {
109
+ (c.key === "Enter" || c.key === " ") && (c.stopPropagation(), r());
110
+ },
111
+ "data-tgph-combobox-clear": !0,
112
+ style: {
113
+ // Remove margin to make the clear button flush
114
+ // with the trigger button
115
+ marginTop: "calc(-1 * var(--tgph-spacing-1)",
116
+ marginBottom: "calc(-1 * var(--tgph-spacing-1)"
117
+ },
118
+ ...o
119
+ }
120
+ ) }) : null;
121
+ }, pe = ({
122
+ children: t,
123
+ ...o
124
+ }) => {
125
+ const e = s.useContext(y), r = s.useMemo(() => {
126
+ var i;
127
+ if (!k(e.value)) return;
128
+ const a = F(
129
+ e.value,
130
+ e.options,
131
+ e.legacyBehavior
132
+ ), c = (a == null ? void 0 : a.label) || (a == null ? void 0 : a.value) || e.placeholder, n = e.legacyBehavior && ((i = e == null ? void 0 : e.value) == null ? void 0 : i.label);
133
+ return n || c;
134
+ }, [
135
+ e.value,
136
+ e.options,
137
+ e.legacyBehavior,
138
+ e.placeholder
139
+ ]);
140
+ return /* @__PURE__ */ l(
141
+ B.Text,
142
+ {
143
+ color: e.value ? "default" : "gray",
144
+ textOverflow: "ellipsis",
145
+ overflow: "hidden",
146
+ ...o,
147
+ children: t || r
148
+ }
149
+ );
150
+ }, ge = ({
151
+ children: t,
152
+ ...o
49
153
  }) => {
50
- const t = $(e);
51
- return (c == null ? void 0 : c.toLowerCase().includes(r.toLowerCase())) || t.some(
52
- (o) => o.toLowerCase().includes(r.toLowerCase())
154
+ const e = s.useContext(y);
155
+ return /* @__PURE__ */ l(B.Text, { color: "gray", ...o, children: t || e.placeholder });
156
+ }, fe = ({ children: t }) => {
157
+ const o = s.useContext(y);
158
+ if (!S(o.value)) return null;
159
+ const e = o.layout || "truncate", a = (o.value.length - 2).toString().split("");
160
+ return /* @__PURE__ */ R(
161
+ I,
162
+ {
163
+ gap: "1",
164
+ w: "full",
165
+ wrap: e === "wrap" ? "wrap" : "nowrap",
166
+ align: "center",
167
+ style: {
168
+ position: "relative",
169
+ flexGrow: 1
170
+ },
171
+ children: [
172
+ /* @__PURE__ */ l(
173
+ M,
174
+ {
175
+ presenceMap: o.value.map((c) => ({
176
+ "tgph-motion-key": C(c, o.legacyBehavior) || "",
177
+ value: !0
178
+ })),
179
+ children: t
180
+ }
181
+ ),
182
+ /* @__PURE__ */ l(
183
+ M,
184
+ {
185
+ presenceMap: [
186
+ {
187
+ "tgph-motion-key": "combobox-more",
188
+ value: !0
189
+ }
190
+ ],
191
+ children: e === "truncate" && o.value.length > 2 && /* @__PURE__ */ l(
192
+ I,
193
+ {
194
+ as: P.div,
195
+ initial: { opacity: 0 },
196
+ animate: { opacity: 1 },
197
+ exit: { opacity: 0 },
198
+ transition: { duration: 100, type: "spring" },
199
+ h: "full",
200
+ pr: "1",
201
+ pl: "8",
202
+ align: "center",
203
+ "aria-label": `${o.value.length - 2} more selected`,
204
+ position: "absolute",
205
+ right: "0",
206
+ style: {
207
+ backgroundImage: "linear-gradient(to left, var(--tgph-surface-1) 0 60%, transparent 90% 100%)"
208
+ },
209
+ children: /* @__PURE__ */ R(H, { as: "span", size: "1", style: { whiteSpace: "nowrap" }, children: [
210
+ "+",
211
+ /* @__PURE__ */ R(
212
+ M,
213
+ {
214
+ presenceMap: a.map((c) => ({
215
+ "tgph-motion-key": c,
216
+ value: !0
217
+ })),
218
+ children: [
219
+ a.map((c) => /* @__PURE__ */ l(
220
+ G,
221
+ {
222
+ as: P.span,
223
+ initial: { opacity: 0 },
224
+ animate: { opacity: 1 },
225
+ exit: { opacity: 0 },
226
+ transition: { duration: 100, type: "spring" },
227
+ w: "2",
228
+ display: "inline-block",
229
+ "tgph-motion-key": c,
230
+ children: c
231
+ },
232
+ c
233
+ )),
234
+ " "
235
+ ]
236
+ }
237
+ ),
238
+ "more"
239
+ ] })
240
+ }
241
+ )
242
+ }
243
+ )
244
+ ]
245
+ }
53
246
  );
54
- }, $ = (e) => {
55
- const c = s.Children.toArray(e), r = [];
56
- return c.forEach((t) => {
57
- typeof t == "string" && r.push(t), s.isValidElement(t) && t.props.children && r.push(...$(t.props.children));
58
- }), r;
59
- }, ie = ["ArrowDown", "PageUp", "Home"], ce = ["ArrowUp", "PageDown", "End"], z = ["Enter", " "], x = s.createContext({
247
+ }, j = s.createContext({
248
+ value: ""
249
+ }), he = ({
250
+ value: t,
251
+ children: o,
252
+ ...e
253
+ }) => /* @__PURE__ */ l(j.Provider, { value: { value: t }, children: /* @__PURE__ */ l(
254
+ K.Root,
255
+ {
256
+ as: P.span,
257
+ initializeWithAnimation: !1,
258
+ initial: { opacity: 0, scale: 0.5 },
259
+ animate: { opacity: 1, scale: 1 },
260
+ exit: { opacity: 0, scale: 0.5 },
261
+ transition: { duration: 100, type: "spring" },
262
+ "tgph-motion-key": t,
263
+ size: "1",
264
+ layout: "position",
265
+ ...e,
266
+ children: o
267
+ }
268
+ ) }), de = ({
269
+ children: t,
270
+ ...o
271
+ }) => {
272
+ const e = s.useContext(y), r = s.useContext(j), a = s.useMemo(() => {
273
+ const c = e.options.find(
274
+ (p) => p.value === r.value
275
+ );
276
+ if (c) return c.label || c.value;
277
+ if (!e.value) return;
278
+ const i = e.value.find(
279
+ (p) => C(p, e.legacyBehavior) === r.value
280
+ );
281
+ if (i)
282
+ return i;
283
+ }, [
284
+ e.options,
285
+ e.value,
286
+ r.value,
287
+ e.legacyBehavior
288
+ ]);
289
+ return /* @__PURE__ */ l(K.Text, { ...o, children: t || a });
290
+ }, me = ({
291
+ children: t,
292
+ ...o
293
+ }) => {
294
+ const e = s.useContext(y), r = s.useContext(j);
295
+ return /* @__PURE__ */ l(
296
+ K.Button,
297
+ {
298
+ icon: { icon: E.X, alt: `Remove ${r.value}` },
299
+ onClick: (a) => {
300
+ if (!e.onValueChange) return;
301
+ const c = e.onValueChange, i = e.value.filter((p) => C(p, e.legacyBehavior) !== r.value);
302
+ c == null || c(i), a.stopPropagation(), a.preventDefault();
303
+ },
304
+ ...o,
305
+ children: t
306
+ }
307
+ );
308
+ }, ye = ({
309
+ value: t,
310
+ children: o,
311
+ ...e
312
+ }) => /* @__PURE__ */ R(D.Root, { value: t, ...e, children: [
313
+ /* @__PURE__ */ l(D.Text, { children: o }),
314
+ /* @__PURE__ */ l(D.Button, {})
315
+ ] }), D = {
316
+ Root: he,
317
+ Text: de,
318
+ Button: me,
319
+ Default: ye
320
+ }, T = {
321
+ TriggerIndicator: le,
322
+ TriggerClear: ue,
323
+ TriggerText: pe,
324
+ TriggerPlaceholder: ge,
325
+ TriggerTagsContainer: fe,
326
+ TriggerTag: D
327
+ }, be = ["ArrowDown", "PageUp", "Home"], xe = ["ArrowUp", "PageDown", "End"], X = ["Enter", " "], y = s.createContext({
60
328
  value: void 0,
61
329
  onValueChange: () => {
62
330
  },
@@ -71,567 +339,379 @@ const ne = {
71
339
  disabled: !1,
72
340
  options: [],
73
341
  legacyBehavior: !1
74
- }), se = ({
75
- modal: e = !0,
76
- closeOnSelect: c = !0,
77
- clearable: r = !1,
78
- disabled: t = !1,
79
- legacyBehavior: o = !1,
80
- open: l,
81
- onOpenChange: i,
82
- defaultOpen: n,
83
- value: a,
84
- onValueChange: f,
85
- errored: g,
342
+ }), ve = ({
343
+ modal: t = !0,
344
+ closeOnSelect: o = !0,
345
+ clearable: e = !1,
346
+ disabled: r = !1,
347
+ legacyBehavior: a = !1,
348
+ open: c,
349
+ onOpenChange: n,
350
+ defaultOpen: i,
351
+ value: p,
352
+ onValueChange: g,
353
+ errored: b,
86
354
  placeholder: v,
87
- layout: m,
355
+ layout: d,
88
356
  children: u,
89
- ...h
357
+ ...f
90
358
  }) => {
91
- const y = s.useId(), b = s.useId(), d = s.useRef(null), w = s.useRef(null), D = s.useRef(null), P = s.useMemo(() => re(u), [u]), [Y, H] = s.useState(""), [O = !1, A] = J({
92
- prop: l,
93
- defaultProp: n,
94
- onChange: i
95
- }), X = s.useCallback(() => {
96
- A((q) => !q);
359
+ const m = s.useId(), x = s.useId(), h = s.useRef(null), w = s.useRef(null), L = s.useRef(null), V = s.useMemo(() => ce(u), [u]), [U, N] = s.useState(""), [O = !1, A] = te({
360
+ prop: c,
361
+ defaultProp: i,
362
+ onChange: n
363
+ }), W = s.useCallback(() => {
364
+ A((J) => !J);
97
365
  }, [A]);
98
366
  return s.useEffect(() => {
99
- O || H("");
100
- }, [O]), /* @__PURE__ */ p(
101
- x.Provider,
367
+ O || N("");
368
+ }, [O]), /* @__PURE__ */ l(
369
+ y.Provider,
102
370
  {
103
371
  value: {
104
- contentId: y,
105
- triggerId: b,
106
- value: a,
372
+ contentId: m,
373
+ triggerId: x,
374
+ value: p,
107
375
  // Need to cast this to avoid type errors
108
376
  // because the type of onValueChange is not
109
377
  // consistent with the value type
110
- onValueChange: f,
378
+ onValueChange: g,
111
379
  placeholder: v,
112
380
  open: O,
113
381
  setOpen: A,
114
- onOpenToggle: X,
115
- closeOnSelect: c,
116
- clearable: r,
117
- disabled: t,
118
- searchQuery: Y,
119
- setSearchQuery: H,
120
- triggerRef: d,
382
+ onOpenToggle: W,
383
+ closeOnSelect: o,
384
+ clearable: e,
385
+ disabled: r,
386
+ searchQuery: U,
387
+ setSearchQuery: N,
388
+ triggerRef: h,
121
389
  searchRef: w,
122
- contentRef: D,
123
- errored: g,
124
- layout: m,
125
- options: P,
126
- legacyBehavior: o
390
+ contentRef: L,
391
+ errored: b,
392
+ layout: d,
393
+ options: V,
394
+ legacyBehavior: a
127
395
  },
128
- children: /* @__PURE__ */ p(
396
+ children: /* @__PURE__ */ l(
129
397
  Q.Root,
130
398
  {
131
399
  open: O,
132
400
  onOpenChange: A,
133
- modal: e,
134
- ...h,
401
+ modal: t,
402
+ ...f,
135
403
  children: u
136
404
  }
137
405
  )
138
406
  }
139
407
  );
140
- }, le = ({ value: e, ...c }) => {
141
- const r = s.useContext(x), t = s.useMemo(() => {
142
- const o = r.options.find((n) => n.value === e);
143
- if (o) return o.label || o.value;
144
- if (!r.value) return;
145
- const i = r.value.find(
146
- (n) => C(n, r.legacyBehavior) === e
147
- );
148
- if (i)
149
- return i;
150
- }, [r.options, r.value, e, r.legacyBehavior]);
151
- return /* @__PURE__ */ S(
152
- L.Root,
153
- {
154
- as: B.span,
155
- initializeWithAnimation: !1,
156
- initial: { opacity: 0, scale: 0.5 },
157
- animate: { opacity: 1, scale: 1 },
158
- exit: { opacity: 0, scale: 0.5 },
159
- transition: { duration: 100, type: "spring" },
160
- "tgph-motion-key": e,
161
- size: "1",
162
- layout: "position",
163
- ...c,
164
- children: [
165
- /* @__PURE__ */ p(L.Text, { children: t }),
166
- /* @__PURE__ */ p(
167
- L.Button,
168
- {
169
- icon: { icon: E.X, alt: `Remove ${e}` },
170
- onClick: (o) => {
171
- if (!r.onValueChange) return;
172
- const l = r.onValueChange, n = r.value.filter((a) => C(a, r.legacyBehavior) !== e);
173
- l == null || l(n), o.stopPropagation(), o.preventDefault();
174
- }
175
- }
176
- )
177
- ]
178
- }
179
- );
180
- }, ue = () => {
181
- var c;
182
- const e = s.useContext(x);
183
- if (e.value && R(e.value)) {
184
- const r = e.layout || "truncate", t = e.value.length - 2, o = t.toString().split("");
185
- return e.value.length === 0 ? /* @__PURE__ */ p(I.Text, { color: "gray", children: e.placeholder }) : /* @__PURE__ */ S(
186
- T,
187
- {
188
- gap: "1",
189
- w: "full",
190
- wrap: r === "wrap" ? "wrap" : "nowrap",
191
- align: "center",
192
- style: {
193
- position: "relative",
194
- flexGrow: 1
195
- },
196
- children: [
197
- /* @__PURE__ */ p(
198
- V,
199
- {
200
- presenceMap: e.value.map((l) => ({
201
- "tgph-motion-key": C(l, e.legacyBehavior) || "",
202
- value: !0
203
- })),
204
- children: e.value.map((l, i) => {
205
- const n = C(l, e.legacyBehavior);
206
- if (n && (r === "truncate" && i <= 1 || r === "wrap"))
207
- return /* @__PURE__ */ p(ee, { children: /* @__PURE__ */ p(le, { value: n }) }, n);
208
- })
209
- }
210
- ),
211
- /* @__PURE__ */ p(
212
- V,
213
- {
214
- presenceMap: [
215
- {
216
- "tgph-motion-key": "combobox-more",
217
- value: !0
218
- }
219
- ],
220
- children: r === "truncate" && e.value.length > 2 && /* @__PURE__ */ p(
221
- T,
222
- {
223
- as: B.div,
224
- initial: { opacity: 0 },
225
- animate: { opacity: 1 },
226
- exit: { opacity: 0 },
227
- transition: { duration: 100, type: "spring" },
228
- h: "full",
229
- pr: "1",
230
- pl: "8",
231
- align: "center",
232
- "aria-label": `${t} more selected`,
233
- position: "absolute",
234
- right: "0",
235
- style: {
236
- backgroundImage: "linear-gradient(to left, var(--tgph-surface-1) 0 60%, transparent 90% 100%)"
237
- },
238
- children: /* @__PURE__ */ S(M, { as: "span", size: "1", style: { whiteSpace: "nowrap" }, children: [
239
- "+",
240
- /* @__PURE__ */ S(
241
- V,
242
- {
243
- presenceMap: o.map((l) => ({
244
- "tgph-motion-key": l,
245
- value: !0
246
- })),
247
- children: [
248
- o.map((l) => /* @__PURE__ */ p(
249
- _,
250
- {
251
- as: B.span,
252
- initial: { opacity: 0 },
253
- animate: { opacity: 1 },
254
- exit: { opacity: 0 },
255
- transition: { duration: 100, type: "spring" },
256
- w: "2",
257
- display: "inline-block",
258
- "tgph-motion-key": l,
259
- children: l
260
- },
261
- l
262
- )),
263
- " "
264
- ]
265
- }
266
- ),
267
- "more"
268
- ] })
269
- }
270
- )
271
- }
272
- )
273
- ]
274
- }
275
- );
276
- }
277
- if (e && k(e.value)) {
278
- const r = F(
279
- e.value,
280
- e.options,
281
- e.legacyBehavior
282
- ), t = (r == null ? void 0 : r.label) || (r == null ? void 0 : r.value) || e.placeholder, o = e.legacyBehavior && ((c = e == null ? void 0 : e.value) == null ? void 0 : c.label);
283
- return /* @__PURE__ */ p(
284
- I.Text,
285
- {
286
- color: e.value ? "default" : "gray",
287
- textOverflow: "ellipsis",
288
- overflow: "hidden",
289
- children: o || t
290
- }
291
- );
408
+ }, Ce = () => {
409
+ const t = s.useContext(y);
410
+ if (t.value && S(t.value)) {
411
+ const o = t.layout || "truncate";
412
+ return t.value.length === 0 ? /* @__PURE__ */ l(T.TriggerPlaceholder, {}) : /* @__PURE__ */ l(T.TriggerTagsContainer, { children: t.value.map((e, r) => {
413
+ const a = C(e, t.legacyBehavior);
414
+ if (a && (o === "truncate" && r <= 1 || o === "wrap"))
415
+ return /* @__PURE__ */ l(re, { children: /* @__PURE__ */ l(T.TriggerTag.Default, { value: a }) }, a);
416
+ }) });
292
417
  }
293
- }, pe = ({
294
- size: e = "2",
295
- children: c,
296
- ...r
418
+ if (t && k(t.value))
419
+ return t.value ? /* @__PURE__ */ l(T.TriggerText, {}) : /* @__PURE__ */ l(T.TriggerPlaceholder, {});
420
+ }, Te = ({
421
+ size: t = "2",
422
+ children: o,
423
+ ...e
297
424
  }) => {
298
- const t = s.useContext(x), o = s.useMemo(() => {
299
- if (t.value) {
300
- if (k(t.value))
425
+ const r = s.useContext(y), a = s.useMemo(() => {
426
+ if (r.value) {
427
+ if (k(r.value))
301
428
  return F(
302
- t.value,
303
- t.options,
304
- t.legacyBehavior
429
+ r.value,
430
+ r.options,
431
+ r.legacyBehavior
305
432
  );
306
- if (R(t.value))
307
- return t.value.map(
308
- (a) => F(a, t.options, t.legacyBehavior)
433
+ if (S(r.value))
434
+ return r.value.map(
435
+ (n) => F(n, r.options, r.legacyBehavior)
309
436
  );
310
437
  }
311
- }, [t.value, t.options, t.legacyBehavior]), l = s.useCallback(() => o ? k(o) ? (o == null ? void 0 : o.label) || (o == null ? void 0 : o.value) || t.placeholder : R(o) && o.map((a) => (a == null ? void 0 : a.label) || (a == null ? void 0 : a.value)).join(", ") || t.placeholder : t.placeholder, [o, t.placeholder]), i = s.useMemo(() => {
312
- var a;
313
- if (k(t.value))
314
- return t.clearable && t.value;
315
- if (R(t.value))
316
- return t.clearable && ((a = t.value) == null ? void 0 : a.length) > 0;
317
- }, [t.clearable, t.value]), n = () => {
318
- var a, f;
319
- if (R(t.value)) {
320
- const g = t.onValueChange;
321
- g == null || g([]);
322
- }
323
- if (k(t.value)) {
324
- const g = t.onValueChange;
325
- g == null || g(void 0);
326
- }
327
- (f = (a = t.triggerRef) == null ? void 0 : a.current) == null || f.focus();
328
- };
329
- return /* @__PURE__ */ p(
438
+ }, [r.value, r.options, r.legacyBehavior]), c = s.useCallback(() => a ? k(a) ? (a == null ? void 0 : a.label) || (a == null ? void 0 : a.value) || r.placeholder : S(a) && a.map((n) => (n == null ? void 0 : n.label) || (n == null ? void 0 : n.value)).join(", ") || r.placeholder : r.placeholder, [a, r.placeholder]);
439
+ return /* @__PURE__ */ l(
330
440
  Q.Trigger,
331
441
  {
332
- ...r,
442
+ ...e,
333
443
  asChild: !0,
334
- onClick: (a) => {
335
- var f, g;
336
- a.preventDefault(), t.onOpenToggle(), (g = (f = t.triggerRef) == null ? void 0 : f.current) == null || g.focus();
444
+ onClick: (n) => {
445
+ var i, p;
446
+ n.preventDefault(), r.onOpenToggle(), (p = (i = r.triggerRef) == null ? void 0 : i.current) == null || p.focus();
337
447
  },
338
- onKeyDown: (a) => {
339
- if (a.key === "Tab") {
340
- a.stopPropagation();
448
+ onKeyDown: (n) => {
449
+ if (n.key === "Tab") {
450
+ n.stopPropagation();
341
451
  return;
342
452
  }
343
- if (z.includes(a.key)) {
344
- a.preventDefault();
453
+ if (X.includes(n.key)) {
454
+ n.preventDefault();
345
455
  return;
346
456
  }
347
- if (a.key === "ArrowDown") {
348
- a.stopPropagation(), a.preventDefault(), t.onOpenToggle();
457
+ if (n.key === "ArrowDown") {
458
+ n.stopPropagation(), n.preventDefault(), r.onOpenToggle();
349
459
  return;
350
460
  }
351
461
  },
352
- tgphRef: t.triggerRef,
353
- children: /* @__PURE__ */ S(
354
- I.Root,
462
+ tgphRef: r.triggerRef,
463
+ children: /* @__PURE__ */ R(
464
+ B.Root,
355
465
  {
356
- id: t.triggerId,
466
+ id: r.triggerId,
357
467
  type: "button",
358
468
  bg: "surface-1",
359
469
  variant: "outline",
360
470
  align: "center",
361
- minH: ne[e],
471
+ minH: ie[t],
362
472
  h: "full",
363
473
  w: "full",
364
474
  py: "1",
365
- size: e,
366
- color: t.errored ? "red" : "gray",
475
+ size: t,
476
+ color: r.errored ? "red" : "gray",
367
477
  justify: "space-between",
368
478
  role: "combobox",
369
- "aria-label": l(),
370
- "aria-controls": t.contentId,
371
- "aria-expanded": t.open,
479
+ "aria-label": c(),
480
+ "aria-controls": r.contentId,
481
+ "aria-expanded": r.open,
372
482
  "aria-haspopup": "listbox",
373
483
  "data-tgph-combobox-trigger": !0,
374
- "data-tgph-combobox-trigger-open": t.open,
375
- disabled: t.disabled,
376
- ...r,
484
+ "data-tgph-combobox-trigger-open": r.open,
485
+ disabled: r.disabled,
486
+ ...e,
377
487
  children: [
378
- c ? typeof c == "function" ? c({ value: o }) : c : /* @__PURE__ */ p(ue, {}),
379
- /* @__PURE__ */ S(T, { align: "center", gap: "1", children: [
380
- i && /* @__PURE__ */ p(oe, { label: "Clear field", children: /* @__PURE__ */ p(
381
- I,
382
- {
383
- type: "button",
384
- icon: { icon: E.X, alt: "Clear field" },
385
- size: "1",
386
- variant: "ghost",
387
- onClick: (a) => {
388
- t.value && (a.stopPropagation(), n());
389
- },
390
- onKeyDown: (a) => {
391
- (a.key === "Enter" || a.key === " ") && (a.stopPropagation(), n());
392
- },
393
- "data-tgph-combobox-clear": !0,
394
- style: {
395
- // Remove margin to make the clear button flush
396
- // with the trigger button
397
- marginTop: "calc(-1 * var(--tgph-spacing-1)",
398
- marginBottom: "calc(-1 * var(--tgph-spacing-1)"
399
- }
400
- }
401
- ) }),
402
- /* @__PURE__ */ p(
403
- I.Icon,
404
- {
405
- as: B.span,
406
- animate: { rotate: t.open ? 180 : 0 },
407
- transition: { duration: 150, type: "spring" },
408
- icon: E.ChevronDown,
409
- "aria-hidden": !0
410
- }
411
- )
488
+ o ? typeof o == "function" ? o({ value: a }) : o : /* @__PURE__ */ l(Ce, {}),
489
+ /* @__PURE__ */ R(I, { align: "center", gap: "1", children: [
490
+ /* @__PURE__ */ l(T.TriggerClear, {}),
491
+ /* @__PURE__ */ l(T.TriggerIndicator, {})
412
492
  ] })
413
493
  ]
414
494
  }
415
495
  )
416
496
  }
417
497
  );
418
- }, fe = ({
419
- style: e,
420
- children: c,
421
- tgphRef: r,
422
- ...t
498
+ }, Re = ({
499
+ style: t,
500
+ children: o,
501
+ tgphRef: e,
502
+ ...r
423
503
  }) => {
424
- const o = s.useContext(x), l = s.useRef(!1), i = j(r, o.contentRef), n = s.useRef(null), [a, f] = s.useState(0), [g, v] = s.useState(!1), m = s.useCallback(
504
+ const a = s.useContext(y), c = s.useRef(!1), n = $(e, a.contentRef), i = s.useRef(null), [p, g] = s.useState(0), [b, v] = s.useState(!1), d = s.useCallback(
425
505
  (u) => {
426
- const h = u == null ? void 0 : u.getBoundingClientRect();
427
- h && f(h.height), g || v(!0);
506
+ const f = u == null ? void 0 : u.getBoundingClientRect();
507
+ f && g(f.height), b || v(!0);
428
508
  },
429
- [g]
509
+ [b]
430
510
  );
431
511
  return s.useEffect(() => {
432
- const u = new ResizeObserver((h) => {
433
- for (const y of h) {
434
- const b = y.target;
435
- m(b);
512
+ const u = new ResizeObserver((f) => {
513
+ for (const m of f) {
514
+ const x = m.target;
515
+ d(x);
436
516
  }
437
517
  });
438
- return n.current && g && u.observe(n.current), () => u.disconnect();
439
- }, [g, m]), s.useEffect(() => {
440
- g === !0 && o.open === !1 && v(!1);
441
- }, [o.open, g]), s.useEffect(() => {
518
+ return i.current && b && u.observe(i.current), () => u.disconnect();
519
+ }, [b, d]), s.useEffect(() => {
520
+ b === !0 && a.open === !1 && v(!1);
521
+ }, [a.open, b]), s.useEffect(() => {
442
522
  let u;
443
- return o.open && (u = setTimeout(() => {
444
- m(n.current);
523
+ return a.open && (u = setTimeout(() => {
524
+ d(i.current);
445
525
  }, 10)), () => u && clearTimeout(u);
446
- }, [o.open, m]), /* @__PURE__ */ p(W.Root, { asChild: !0, children: /* @__PURE__ */ p(
447
- U,
526
+ }, [a.open, d]), /* @__PURE__ */ l(ee.Root, { asChild: !0, children: /* @__PURE__ */ l(
527
+ Z,
448
528
  {
449
529
  onEscapeKeyDown: (u) => {
450
- o.open && (u.stopPropagation(), u.preventDefault(), o.setOpen(!1));
530
+ a.open && (u.stopPropagation(), u.preventDefault(), a.setOpen(!1));
451
531
  },
452
- children: /* @__PURE__ */ p(
532
+ children: /* @__PURE__ */ l(
453
533
  Q.Content,
454
534
  {
455
535
  className: "tgph",
456
536
  mt: "1",
457
537
  onCloseAutoFocus: (u) => {
458
- var h, y;
459
- l.current || (y = (h = o.triggerRef) == null ? void 0 : h.current) == null || y.focus(), l.current = !1, u.preventDefault();
538
+ var f, m;
539
+ c.current || (m = (f = a.triggerRef) == null ? void 0 : f.current) == null || m.focus(), c.current = !1, u.preventDefault();
460
540
  },
461
541
  bg: "surface-1",
462
542
  style: {
463
543
  width: "var(--tgph-combobox-trigger-width)",
464
544
  transition: "min-height 200ms ease-in-out",
465
- minHeight: a ? `${a}px` : "0",
466
- ...e,
545
+ minHeight: p ? `${p}px` : "0",
546
+ ...t,
467
547
  "--tgph-combobox-content-transform-origin": "var(--radix-popper-transform-origin)",
468
548
  "--tgph-combobox-content-available-width": "var(--radix-popper-available-width)",
469
549
  "--tgph-combobox-content-available-height": "calc(var(--radix-popper-available-height) - var(--tgph-spacing-8))",
470
550
  "--tgph-combobox-trigger-width": "var(--radix-popper-anchor-width)",
471
551
  "--tgph-combobox-trigger-height": "var(--radix-popper-anchor-height)"
472
552
  },
473
- ...t,
474
- tgphRef: i,
553
+ ...r,
554
+ tgphRef: n,
475
555
  "data-tgph-combobox-content": !0,
476
- "data-tgph-combobox-content-open": o.open,
556
+ "data-tgph-combobox-content-open": a.open,
477
557
  role: void 0,
478
558
  "aria-orientation": void 0,
479
559
  onKeyDown: (u) => {
480
- var y, b, d, w;
560
+ var m, x, h, w;
481
561
  u.stopPropagation();
482
- const h = (b = (y = o.contentRef) == null ? void 0 : y.current) == null ? void 0 : b.querySelectorAll(
562
+ const f = (x = (m = a.contentRef) == null ? void 0 : m.current) == null ? void 0 : x.querySelectorAll(
483
563
  "[data-tgph-combobox-option]"
484
564
  );
485
- document.activeElement === (h == null ? void 0 : h[0]) && ce.includes(u.key) && ((w = (d = o.searchRef) == null ? void 0 : d.current) == null || w.focus());
565
+ document.activeElement === (f == null ? void 0 : f[0]) && xe.includes(u.key) && ((w = (h = a.searchRef) == null ? void 0 : h.current) == null || w.focus());
486
566
  },
487
- children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", tgphRef: n, children: c })
567
+ children: /* @__PURE__ */ l(I, { direction: "column", gap: "1", tgphRef: i, children: o })
488
568
  }
489
569
  )
490
570
  }
491
571
  ) });
492
- }, ge = ({ ...e }) => {
493
- const c = s.useContext(x);
494
- return /* @__PURE__ */ p(
495
- T,
572
+ }, Se = ({ ...t }) => {
573
+ const o = s.useContext(y);
574
+ return /* @__PURE__ */ l(
575
+ I,
496
576
  {
497
- id: c.contentId,
577
+ id: o.contentId,
498
578
  direction: "column",
499
579
  gap: "1",
500
580
  style: {
501
581
  overflowY: "auto",
502
582
  // maxHeight defaults to available height - padding from edge of screen
503
- "--max-height": e.maxHeight ? void 0 : "calc(var(--tgph-combobox-content-available-height) - var(--tgph-spacing-12))"
583
+ "--max-height": t.maxHeight ? void 0 : "calc(var(--tgph-combobox-content-available-height) - var(--tgph-spacing-12))"
504
584
  },
505
585
  role: "listbox",
506
- ...e
586
+ ...t
507
587
  }
508
588
  );
509
- }, G = ({
510
- value: e,
511
- label: c,
512
- selected: r,
513
- onSelect: t,
514
- children: o,
515
- ...l
589
+ }, q = ({
590
+ value: t,
591
+ label: o,
592
+ selected: e,
593
+ onSelect: r,
594
+ children: a,
595
+ ...c
516
596
  }) => {
517
- const i = s.useContext(x), [n, a] = s.useState(!1), f = i.value, g = !i.searchQuery || ae({
518
- children: c || o,
519
- value: e,
520
- searchQuery: i.searchQuery
521
- }), v = R(f) ? f.some(
522
- (u) => C(u, i.legacyBehavior) === e
523
- ) : C(f, i.legacyBehavior) === e, m = (u) => {
524
- var y, b;
597
+ const n = s.useContext(y), [i, p] = s.useState(!1), g = n.value, b = !n.searchQuery || se({
598
+ children: o || a,
599
+ value: t,
600
+ searchQuery: n.searchQuery
601
+ }), v = S(g) ? g.some(
602
+ (u) => C(u, n.legacyBehavior) === t
603
+ ) : C(g, n.legacyBehavior) === t, d = (u) => {
604
+ var m, x;
525
605
  u.stopPropagation();
526
- const h = u;
527
- if (!(h.key && !z.includes(h.key))) {
528
- if (u.preventDefault(), i.closeOnSelect === !0 && i.setOpen(!1), t)
529
- return t(u);
530
- if (k(f)) {
531
- const d = i.onValueChange;
532
- i.legacyBehavior === !0 ? d == null || d({ value: e, label: c }) : d == null || d(e);
533
- } else if (R(f)) {
534
- const d = i.onValueChange, w = i.value, D = v ? w.filter(
535
- (P) => C(P, i.legacyBehavior) !== e
606
+ const f = u;
607
+ if (!(f.key && !X.includes(f.key))) {
608
+ if (u.preventDefault(), n.closeOnSelect === !0 && n.setOpen(!1), r)
609
+ return r(u);
610
+ if (k(g)) {
611
+ const h = n.onValueChange;
612
+ n.legacyBehavior === !0 ? h == null || h({ value: t, label: o }) : h == null || h(t);
613
+ } else if (S(g)) {
614
+ const h = n.onValueChange, w = n.value, L = v ? w.filter(
615
+ (V) => C(V, n.legacyBehavior) !== t
536
616
  ) : [
537
617
  ...w,
538
618
  // TODO: Remove this once { value, label } option is deprecated
539
- i.legacyBehavior === !0 ? { value: e, label: c } : e
619
+ n.legacyBehavior === !0 ? { value: t, label: o } : t
540
620
  ];
541
- d == null || d(D);
621
+ h == null || h(L);
542
622
  }
543
- (b = (y = i.triggerRef) == null ? void 0 : y.current) == null || b.focus();
623
+ (x = (m = n.triggerRef) == null ? void 0 : m.current) == null || x.focus();
544
624
  }
545
625
  };
546
- if (g)
547
- return /* @__PURE__ */ p(
626
+ if (b)
627
+ return /* @__PURE__ */ l(
548
628
  Q.Button,
549
629
  {
550
630
  type: "button",
551
- onSelect: m,
552
- onKeyDown: m,
553
- selected: r === null ? null : r ?? v,
554
- onFocus: () => a(!0),
555
- onBlur: () => a(!1),
631
+ onSelect: d,
632
+ onKeyDown: d,
633
+ selected: e === null ? null : e ?? v,
634
+ onFocus: () => p(!0),
635
+ onBlur: () => p(!1),
556
636
  role: "option",
557
637
  "aria-selected": v ? "true" : "false",
558
638
  "data-tgph-combobox-option": !0,
559
- "data-tgph-combobox-option-focused": n,
560
- "data-tgph-combobox-option-value": e,
561
- "data-tgph-combobox-option-label": c,
562
- ...l,
563
- children: c || o || e
639
+ "data-tgph-combobox-option-focused": i,
640
+ "data-tgph-combobox-option-value": t,
641
+ "data-tgph-combobox-option-label": o,
642
+ ...c,
643
+ children: o || a || t
564
644
  }
565
645
  );
566
- }, he = ({
567
- label: e = "Search",
568
- placeholder: c = "Search",
569
- tgphRef: r,
570
- value: t,
571
- onValueChange: o,
572
- ...l
646
+ }, we = ({
647
+ label: t = "Search",
648
+ placeholder: o = "Search",
649
+ tgphRef: e,
650
+ value: r,
651
+ onValueChange: a,
652
+ ...c
573
653
  }) => {
574
654
  var v;
575
- const i = s.useId(), n = s.useContext(x), a = j(r, n.searchRef), f = t ?? n.searchQuery, g = o ?? n.setSearchQuery;
655
+ const n = s.useId(), i = s.useContext(y), p = $(e, i.searchRef), g = r ?? i.searchQuery, b = a ?? i.setSearchQuery;
576
656
  return s.useEffect(() => {
577
- var h;
578
- const m = (y) => {
579
- var b, d;
580
- ie.includes(y.key) && ((d = (b = n.contentRef) == null ? void 0 : b.current) == null || d.focus({ preventScroll: !0 })), y.key === "Escape" && n.setOpen(!1), y.stopPropagation();
581
- }, u = (h = n.searchRef) == null ? void 0 : h.current;
657
+ var f;
658
+ const d = (m) => {
659
+ var x, h;
660
+ be.includes(m.key) && ((h = (x = i.contentRef) == null ? void 0 : x.current) == null || h.focus({ preventScroll: !0 })), m.key === "Escape" && i.setOpen(!1), m.stopPropagation();
661
+ }, u = (f = i.searchRef) == null ? void 0 : f.current;
582
662
  if (u)
583
- return u.addEventListener("keydown", m), () => {
584
- u.removeEventListener("keydown", m);
663
+ return u.addEventListener("keydown", d), () => {
664
+ u.removeEventListener("keydown", d);
585
665
  };
586
- }, [n]), /* @__PURE__ */ S(_, { borderBottom: "px", px: "1", pb: "1", children: [
587
- /* @__PURE__ */ p(Z.Root, { children: /* @__PURE__ */ p(M, { as: "label", htmlFor: i, children: e }) }),
588
- /* @__PURE__ */ p(
589
- te,
666
+ }, [i]), /* @__PURE__ */ R(G, { borderBottom: "px", px: "1", pb: "1", children: [
667
+ /* @__PURE__ */ l(oe.Root, { children: /* @__PURE__ */ l(H, { as: "label", htmlFor: n, children: t }) }),
668
+ /* @__PURE__ */ l(
669
+ ne,
590
670
  {
591
- id: i,
671
+ id: n,
592
672
  variant: "ghost",
593
- placeholder: c,
594
- value: f,
595
- onChange: (m) => {
596
- g(m.target.value);
673
+ placeholder: o,
674
+ value: g,
675
+ onChange: (d) => {
676
+ b(d.target.value);
597
677
  },
598
- LeadingComponent: /* @__PURE__ */ p(N, { icon: E.Search, alt: "Search Icon" }),
599
- TrailingComponent: n != null && n.searchQuery && ((v = n == null ? void 0 : n.searchQuery) == null ? void 0 : v.length) > 0 ? /* @__PURE__ */ p(
600
- I,
678
+ LeadingComponent: /* @__PURE__ */ l(z, { icon: E.Search, alt: "Search Icon" }),
679
+ TrailingComponent: i != null && i.searchQuery && ((v = i == null ? void 0 : i.searchQuery) == null ? void 0 : v.length) > 0 ? /* @__PURE__ */ l(
680
+ B,
601
681
  {
602
682
  variant: "ghost",
603
683
  color: "gray",
604
684
  icon: { icon: E.X, alt: "Clear Search Query" },
605
685
  onClick: () => {
606
- var m;
607
- return (m = n.setSearchQuery) == null ? void 0 : m.call(n, "");
686
+ var d;
687
+ return (d = i.setSearchQuery) == null ? void 0 : d.call(i, "");
608
688
  }
609
689
  }
610
690
  ) : null,
611
691
  autoFocus: !0,
612
692
  "data-tgph-combobox-search": !0,
613
- "aria-controls": n.contentId,
614
- ...l,
615
- tgphRef: a
693
+ "aria-controls": i.contentId,
694
+ ...c,
695
+ tgphRef: p
616
696
  }
617
697
  )
618
698
  ] });
619
- }, de = ({
620
- icon: e = { icon: E.Search, alt: "Search Icon" },
621
- message: c = "No results found",
622
- children: r,
623
- ...t
699
+ }, Ee = ({
700
+ icon: t = { icon: E.Search, alt: "Search Icon" },
701
+ message: o = "No results found",
702
+ children: e,
703
+ ...r
624
704
  }) => {
625
- const o = s.useContext(x), [l, i] = s.useState(!1);
705
+ const a = s.useContext(y), [c, n] = s.useState(!1);
626
706
  if (s.useEffect(() => {
627
- var a, f;
628
- const n = (f = (a = o.contentRef) == null ? void 0 : a.current) == null ? void 0 : f.querySelectorAll(
707
+ var p, g;
708
+ const i = (g = (p = a.contentRef) == null ? void 0 : p.current) == null ? void 0 : g.querySelectorAll(
629
709
  "[data-tgph-combobox-option]"
630
710
  );
631
- (n == null ? void 0 : n.length) === 0 ? i(!0) : i(!1);
632
- }, [o.searchQuery, o.contentRef, r]), l)
633
- return /* @__PURE__ */ S(
634
- T,
711
+ (i == null ? void 0 : i.length) === 0 ? n(!0) : n(!1);
712
+ }, [a.searchQuery, a.contentRef, e]), c)
713
+ return /* @__PURE__ */ R(
714
+ I,
635
715
  {
636
716
  gap: "1",
637
717
  align: "center",
@@ -639,58 +719,59 @@ const ne = {
639
719
  w: "full",
640
720
  my: "8",
641
721
  "data-tgph-combobox-empty": !0,
642
- ...t,
722
+ ...r,
643
723
  children: [
644
- e === null ? /* @__PURE__ */ p(K, {}) : /* @__PURE__ */ p(N, { ...e }),
645
- c === null ? /* @__PURE__ */ p(K, {}) : /* @__PURE__ */ p(M, { as: "span", children: c })
724
+ t === null ? /* @__PURE__ */ l(_, {}) : /* @__PURE__ */ l(z, { ...t }),
725
+ o === null ? /* @__PURE__ */ l(_, {}) : /* @__PURE__ */ l(H, { as: "span", children: o })
646
726
  ]
647
727
  }
648
728
  );
649
- }, me = ({
650
- leadingText: e = "Create",
651
- values: c,
652
- onCreate: r,
653
- selected: t = null,
654
- legacyBehavior: o = !1,
655
- ...l
729
+ }, ke = ({
730
+ leadingText: t = "Create",
731
+ values: o,
732
+ onCreate: e,
733
+ selected: r = null,
734
+ legacyBehavior: a = !1,
735
+ ...c
656
736
  }) => {
657
- const i = s.useContext(x), n = s.useCallback(
658
- (a) => !c || (c == null ? void 0 : c.length) === 0 ? !1 : c.some(
659
- (f) => C(f, o) === a
737
+ const n = s.useContext(y), i = s.useCallback(
738
+ (p) => !o || (o == null ? void 0 : o.length) === 0 ? !1 : o.some(
739
+ (g) => C(g, a) === p
660
740
  ),
661
- [c, o]
741
+ [o, a]
662
742
  );
663
- if (i.searchQuery && !n(i.searchQuery))
664
- return /* @__PURE__ */ p(
665
- G,
743
+ if (n.searchQuery && !i(n.searchQuery))
744
+ return /* @__PURE__ */ l(
745
+ q,
666
746
  {
667
747
  leadingIcon: { icon: E.Plus, "aria-hidden": !0 },
668
748
  mx: "1",
669
- value: i.searchQuery,
670
- label: `${e} "${i.searchQuery}"`,
671
- selected: t,
749
+ value: n.searchQuery,
750
+ label: `${t} "${n.searchQuery}"`,
751
+ selected: r,
672
752
  onSelect: () => {
673
- var a;
674
- if (r && i.value && i.searchQuery) {
675
- const f = o === !0 ? { value: i.searchQuery } : i.searchQuery;
676
- r(f), (a = i.setSearchQuery) == null || a.call(i, "");
753
+ var p;
754
+ if (e && n.value && n.searchQuery) {
755
+ const g = a === !0 ? { value: n.searchQuery } : n.searchQuery;
756
+ e(g), (p = n.setSearchQuery) == null || p.call(n, "");
677
757
  }
678
758
  },
679
- ...l
759
+ ...c
680
760
  }
681
761
  );
682
- }, ye = {};
683
- Object.assign(ye, {
684
- Root: se,
685
- Trigger: pe,
686
- Content: fe,
687
- Options: ge,
688
- Option: G,
689
- Search: he,
690
- Empty: de,
691
- Create: me
762
+ }, Ie = {};
763
+ Object.assign(Ie, {
764
+ Root: ve,
765
+ Trigger: Te,
766
+ Content: Re,
767
+ Options: Se,
768
+ Option: q,
769
+ Search: we,
770
+ Empty: Ee,
771
+ Create: ke,
772
+ Primitives: T
692
773
  });
693
774
  export {
694
- ye as Combobox
775
+ Ie as Combobox
695
776
  };
696
777
  //# sourceMappingURL=index.mjs.map