@utk09/finra-ui 0.0.4 → 0.0.5

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.
@@ -0,0 +1,471 @@
1
+ import { jsx as u, jsxs as m, Fragment as ge } from "react/jsx-runtime";
2
+ import { forwardRef as w, isValidElement as _e, cloneElement as je, useRef as M, useEffect as X, useId as Oe, useState as Q, useCallback as B, useMemo as C } from "react";
3
+ function V(...o) {
4
+ return (s) => {
5
+ for (const r of o)
6
+ typeof r == "function" ? r(s) : r && typeof r == "object" && (r.current = s);
7
+ };
8
+ }
9
+ function Ae(o, s) {
10
+ const r = { ...o, ...s };
11
+ for (const a of Object.keys(o)) {
12
+ if (a === "children" || a === "ref") continue;
13
+ const f = o[a], c = s[a];
14
+ typeof f == "function" && typeof c == "function" && (r[a] = (...v) => {
15
+ c(...v), f(...v);
16
+ }), a === "className" && typeof f == "string" && typeof c == "string" && (r[a] = `${f} ${c}`.trim()), a === "style" && typeof f == "object" && typeof c == "object" && (r[a] = { ...f, ...c });
17
+ }
18
+ return r;
19
+ }
20
+ const Y = w(
21
+ ({ children: o, ...s }, r) => {
22
+ if (!_e(o))
23
+ return null;
24
+ const a = o.props, f = o.ref;
25
+ return je(o, {
26
+ ...Ae(s, a),
27
+ ref: V(r, f)
28
+ });
29
+ }
30
+ );
31
+ Y.displayName = "Slot";
32
+ const Ke = w(
33
+ ({ asChild: o = !1, ...s }, r) => /* @__PURE__ */ u(o ? Y : "button", { ref: r, ...s })
34
+ );
35
+ Ke.displayName = "ButtonBase";
36
+ const qe = w(
37
+ ({ asChild: o = !1, icon: s, children: r, ...a }, f) => /* @__PURE__ */ m(o ? Y : "button", { ref: f, ...a, children: [
38
+ s,
39
+ r
40
+ ] })
41
+ );
42
+ qe.displayName = "IconButtonBase";
43
+ const Pe = w(
44
+ ({ indeterminate: o, ...s }, r) => {
45
+ const a = M(null);
46
+ return X(() => {
47
+ a.current && (a.current.indeterminate = o ?? !1);
48
+ }, [o]), /* @__PURE__ */ u("input", { ref: V(r, a), type: "checkbox", ...s });
49
+ }
50
+ );
51
+ Pe.displayName = "CheckboxBase";
52
+ const Te = w((o, s) => /* @__PURE__ */ u("input", { ref: s, type: "checkbox", role: "switch", ...o }));
53
+ Te.displayName = "SwitchBase";
54
+ const Ue = w((o, s) => /* @__PURE__ */ u("input", { ref: s, type: "radio", ...o }));
55
+ Ue.displayName = "RadioButtonBase";
56
+ const ze = w((o, s) => /* @__PURE__ */ u("input", { ref: s, type: "range", ...o }));
57
+ ze.displayName = "SliderBase";
58
+ function Ge(o, s) {
59
+ return s ? o.label.toLowerCase().includes(s.toLowerCase()) : !0;
60
+ }
61
+ function me(o) {
62
+ const s = [], r = /* @__PURE__ */ new Map(), a = [];
63
+ for (const c of o)
64
+ if (c.favourite && s.push(c), c.group) {
65
+ const v = r.get(c.group) ?? [];
66
+ v.push(c), r.set(c.group, v);
67
+ } else
68
+ a.push(c);
69
+ const f = [];
70
+ for (const [c, v] of r)
71
+ f.push({ label: c, options: v });
72
+ return { favourites: s, groups: f, ungrouped: a };
73
+ }
74
+ function W(...o) {
75
+ return o.filter(Boolean).join(" ") || void 0;
76
+ }
77
+ function Je({
78
+ options: o,
79
+ value: s,
80
+ onChange: r,
81
+ multiple: a = !1,
82
+ inputValue: f,
83
+ onInputChange: c,
84
+ filterFn: v,
85
+ loading: ve = !1,
86
+ onLoadOptions: Z,
87
+ creatable: Ne = !1,
88
+ onCreateOption: _,
89
+ formatCreateLabel: ee,
90
+ header: te,
91
+ footer: oe,
92
+ placeholder: j,
93
+ disabled: D = !1,
94
+ noOptionsMessage: xe = "No options",
95
+ renderOption: se,
96
+ renderValue: S,
97
+ renderCheckIcon: ae,
98
+ renderIndicator: ne,
99
+ renderPillRemoveIcon: re,
100
+ renderLoading: ie,
101
+ open: O,
102
+ onOpenChange: le,
103
+ classNames: n,
104
+ dataAttributes: ye,
105
+ "aria-label": Be,
106
+ "aria-labelledby": we,
107
+ ...De
108
+ }, ue) {
109
+ const ce = Oe(), A = `${ce}-listbox`, F = M(null), K = M(null), q = M(null), [Se, ke] = Q(""), [Ie, Re] = Q(!1), [h, g] = Q(-1), l = O ?? Ie, d = f ?? Se, p = B(
110
+ (e) => {
111
+ O === void 0 && Re(e), le?.(e);
112
+ },
113
+ [O, le]
114
+ ), x = B(
115
+ (e) => {
116
+ f === void 0 && ke(e), c?.(e);
117
+ },
118
+ [f, c]
119
+ ), b = C(() => s == null ? [] : Array.isArray(s) ? s : [s], [s]), P = B(
120
+ (e) => b.some((t) => t === e),
121
+ [b]
122
+ ), fe = v ?? Ge, L = C(
123
+ () => o.filter((e) => fe(e, d)),
124
+ [o, fe, d]
125
+ ), $ = C(() => {
126
+ const { favourites: e, groups: t, ungrouped: i } = me(L), y = [];
127
+ for (const R of e) y.push(R);
128
+ for (const R of t)
129
+ for (const he of R.options)
130
+ he.favourite || y.push(he);
131
+ for (const R of i)
132
+ R.favourite || y.push(R);
133
+ return y;
134
+ }, [L]), E = Ne && d.trim() !== "" && !o.some((e) => e.label.toLowerCase() === d.trim().toLowerCase()), Ce = ee ? ee(d.trim()) : `Create "${d.trim()}"`, k = $.length + (E ? 1 : 0), T = B(
135
+ (e) => {
136
+ if (!e.disabled) {
137
+ if (a) {
138
+ const t = P(e.value) ? b.filter((i) => i !== e.value) : [...b, e.value];
139
+ r?.(t), x("");
140
+ } else
141
+ r?.(e.value), x(e.label), p(!1);
142
+ F.current?.focus();
143
+ }
144
+ },
145
+ [a, P, b, r, x, p]
146
+ ), U = B(
147
+ (e) => {
148
+ if (!a) return;
149
+ const t = b.filter((i) => i !== e);
150
+ r?.(t.length > 0 ? t : null), F.current?.focus();
151
+ },
152
+ [a, b, r]
153
+ ), $e = B(
154
+ (e) => {
155
+ if (!D)
156
+ switch (e.key) {
157
+ case "ArrowDown": {
158
+ e.preventDefault(), l ? g((t) => (t + 1) % k) : (p(!0), g(0));
159
+ break;
160
+ }
161
+ case "ArrowUp": {
162
+ e.preventDefault(), l ? g((t) => (t - 1 + k) % k) : (p(!0), g(k - 1));
163
+ break;
164
+ }
165
+ case "Enter": {
166
+ e.preventDefault(), l && h >= 0 ? h < $.length ? T($[h]) : E && (_?.(d.trim()), x("")) : l || p(!0);
167
+ break;
168
+ }
169
+ case "Escape": {
170
+ l && (e.preventDefault(), p(!1), g(-1));
171
+ break;
172
+ }
173
+ case "Backspace": {
174
+ a && d === "" && b.length > 0 && U(b[b.length - 1]);
175
+ break;
176
+ }
177
+ case "Home": {
178
+ l && (e.preventDefault(), g(0));
179
+ break;
180
+ }
181
+ case "End": {
182
+ l && (e.preventDefault(), g(k - 1));
183
+ break;
184
+ }
185
+ }
186
+ },
187
+ [
188
+ D,
189
+ l,
190
+ p,
191
+ h,
192
+ k,
193
+ $,
194
+ T,
195
+ E,
196
+ _,
197
+ d,
198
+ x,
199
+ a,
200
+ b,
201
+ U
202
+ ]
203
+ ), Ee = B(
204
+ (e) => {
205
+ const t = e.target.value;
206
+ x(t), l || p(!0), g(0), Z?.(t);
207
+ },
208
+ [x, l, p, Z]
209
+ ), Fe = B(() => {
210
+ !D && !l && p(!0);
211
+ }, [D, l, p]);
212
+ X(() => {
213
+ if (!l) return;
214
+ const e = (t) => {
215
+ q.current && !q.current.contains(t.target) && (p(!1), g(-1));
216
+ };
217
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
218
+ }, [l, p]), X(() => {
219
+ if (h < 0 || !K.current) return;
220
+ const e = K.current.querySelector(`[data-index="${h}"]`);
221
+ e && e.scrollIntoView?.({ block: "nearest" });
222
+ }, [h]);
223
+ const { favourites: z, groups: de, ungrouped: Le } = C(
224
+ () => me(L),
225
+ [L]
226
+ ), G = (e) => `${ce}-option-${e}`, H = (e, t) => {
227
+ const i = {
228
+ isSelected: P(e.value),
229
+ isHighlighted: h === t,
230
+ isDisabled: e.disabled ?? !1,
231
+ isFavourite: e.favourite ?? !1
232
+ };
233
+ return /* @__PURE__ */ u(
234
+ "div",
235
+ {
236
+ id: G(t),
237
+ role: "option",
238
+ tabIndex: -1,
239
+ "data-index": t,
240
+ "aria-selected": i.isSelected,
241
+ "aria-disabled": i.isDisabled || void 0,
242
+ "data-highlighted": i.isHighlighted || void 0,
243
+ "data-selected": i.isSelected || void 0,
244
+ "data-disabled": i.isDisabled || void 0,
245
+ className: W(
246
+ n?.option,
247
+ i.isHighlighted && n?.optionHighlighted,
248
+ i.isSelected && n?.optionSelected,
249
+ i.isDisabled && n?.optionDisabled
250
+ ),
251
+ onMouseDown: (y) => {
252
+ y.preventDefault(), T(e);
253
+ },
254
+ onMouseEnter: () => g(t),
255
+ children: se ? se(e, i) : /* @__PURE__ */ m(ge, { children: [
256
+ /* @__PURE__ */ u("span", { className: n?.optionLabel, children: e.label }),
257
+ i.isSelected && ae ? ae() : null
258
+ ] })
259
+ },
260
+ `${t}-${String(e.value)}`
261
+ );
262
+ }, He = () => a ? b.map((e) => {
263
+ const t = o.find((i) => i.value === e);
264
+ return t ? /* @__PURE__ */ m("span", { className: n?.pill, "data-combobox-pill": !0, children: [
265
+ /* @__PURE__ */ u("span", { className: n?.pillText, children: S ? S(t) : t.label }),
266
+ D ? null : /* @__PURE__ */ u(
267
+ "button",
268
+ {
269
+ type: "button",
270
+ className: n?.pillRemove,
271
+ tabIndex: -1,
272
+ "aria-label": `Remove ${t.label}`,
273
+ onMouseDown: (i) => {
274
+ i.preventDefault(), i.stopPropagation(), U(e);
275
+ },
276
+ children: re ? re() : "×"
277
+ }
278
+ )
279
+ ] }, String(e)) : null;
280
+ }) : null, Me = C(() => {
281
+ if (a || l) return d;
282
+ if (s != null && !S) {
283
+ const e = o.find((t) => t.value === s);
284
+ if (e) return e.label;
285
+ }
286
+ return d;
287
+ }, [a, l, d, s, o, S]), pe = C(() => {
288
+ if (a || l || s == null || !S) return null;
289
+ const e = o.find((t) => t.value === s);
290
+ return e ? /* @__PURE__ */ u("span", { className: n?.singleValue, children: S(e) }) : null;
291
+ }, [a, l, s, o, S, n?.singleValue]), I = [];
292
+ let N = 0;
293
+ z.length > 0 && I.push(
294
+ /* @__PURE__ */ m(
295
+ "div",
296
+ {
297
+ role: "group",
298
+ "aria-label": "Favourites",
299
+ className: n?.group,
300
+ "data-combobox-group": "favourites",
301
+ children: [
302
+ /* @__PURE__ */ u("div", { className: n?.groupLabel, "data-combobox-group-label": !0, "aria-hidden": "true", children: "Favourites" }),
303
+ z.map((e) => {
304
+ const t = H(e, N);
305
+ return N++, t;
306
+ })
307
+ ]
308
+ },
309
+ "__fav-group"
310
+ )
311
+ );
312
+ for (const e of de) {
313
+ const t = e.options.filter((i) => !i.favourite);
314
+ t.length !== 0 && I.push(
315
+ /* @__PURE__ */ m(
316
+ "div",
317
+ {
318
+ role: "group",
319
+ "aria-label": e.label,
320
+ className: n?.group,
321
+ "data-combobox-group": e.label,
322
+ children: [
323
+ /* @__PURE__ */ u("div", { className: n?.groupLabel, "data-combobox-group-label": !0, "aria-hidden": "true", children: e.label }),
324
+ t.map((i) => {
325
+ const y = H(i, N);
326
+ return N++, y;
327
+ })
328
+ ]
329
+ },
330
+ `__group-${e.label}`
331
+ )
332
+ );
333
+ }
334
+ const J = Le.filter((e) => !e.favourite);
335
+ if (J.length > 0)
336
+ if (z.length > 0 || de.length > 0)
337
+ I.push(
338
+ /* @__PURE__ */ m(
339
+ "div",
340
+ {
341
+ role: "group",
342
+ "aria-label": "All",
343
+ className: n?.group,
344
+ "data-combobox-group": "all",
345
+ children: [
346
+ /* @__PURE__ */ u("div", { className: n?.groupLabel, "data-combobox-group-label": !0, "aria-hidden": "true", children: "All" }),
347
+ J.map((e) => {
348
+ const t = H(e, N);
349
+ return N++, t;
350
+ })
351
+ ]
352
+ },
353
+ "__ungrouped"
354
+ )
355
+ );
356
+ else
357
+ for (const e of J)
358
+ I.push(H(e, N)), N++;
359
+ if (E) {
360
+ const e = N;
361
+ I.push(
362
+ /* @__PURE__ */ u(
363
+ "div",
364
+ {
365
+ id: G(e),
366
+ role: "option",
367
+ tabIndex: -1,
368
+ "data-index": e,
369
+ "aria-selected": !1,
370
+ "data-highlighted": h === e || void 0,
371
+ "data-combobox-create": !0,
372
+ className: W(
373
+ n?.option,
374
+ n?.optionCreate,
375
+ h === e && n?.optionHighlighted
376
+ ),
377
+ onMouseDown: (t) => {
378
+ t.preventDefault(), _?.(d.trim()), x("");
379
+ },
380
+ onMouseEnter: () => g(e),
381
+ children: Ce
382
+ },
383
+ "__create"
384
+ )
385
+ );
386
+ }
387
+ const Ve = $.length > 0 || E, be = {
388
+ type: "text",
389
+ role: "searchbox",
390
+ "aria-autocomplete": "list",
391
+ "aria-controls": l ? A : void 0,
392
+ "aria-activedescendant": l && h >= 0 ? G(h) : void 0,
393
+ "aria-label": Be ?? j,
394
+ "aria-labelledby": we,
395
+ onChange: Ee,
396
+ onKeyDown: $e,
397
+ onFocus: Fe,
398
+ disabled: D
399
+ };
400
+ return /* @__PURE__ */ m("div", { ref: q, className: n?.root, ...ye, ...De, children: [
401
+ /* @__PURE__ */ m(
402
+ "div",
403
+ {
404
+ role: "combobox",
405
+ "aria-expanded": l,
406
+ "aria-controls": l ? A : void 0,
407
+ "aria-haspopup": "listbox",
408
+ "aria-disabled": D || void 0,
409
+ className: n?.wrapper,
410
+ children: [
411
+ a ? /* @__PURE__ */ m("div", { className: n?.multiValueContainer, children: [
412
+ He(),
413
+ /* @__PURE__ */ u(
414
+ "input",
415
+ {
416
+ ref: V(ue, F),
417
+ className: n?.input,
418
+ ...be,
419
+ value: d,
420
+ placeholder: b.length === 0 ? j : void 0
421
+ }
422
+ )
423
+ ] }) : /* @__PURE__ */ m(ge, { children: [
424
+ pe,
425
+ /* @__PURE__ */ u(
426
+ "input",
427
+ {
428
+ ref: V(ue, F),
429
+ className: W(n?.input, pe ? n?.inputHidden : void 0),
430
+ ...be,
431
+ value: Me,
432
+ placeholder: j
433
+ }
434
+ )
435
+ ] }),
436
+ ne ? ne(l) : null
437
+ ]
438
+ }
439
+ ),
440
+ l ? /* @__PURE__ */ m("div", { className: n?.listbox, children: [
441
+ te ? /* @__PURE__ */ u("div", { className: n?.header, children: te }) : null,
442
+ /* @__PURE__ */ u(
443
+ "div",
444
+ {
445
+ ref: K,
446
+ id: A,
447
+ role: "listbox",
448
+ "aria-multiselectable": a || void 0,
449
+ className: n?.options,
450
+ tabIndex: -1,
451
+ children: ve ? /* @__PURE__ */ u("div", { role: "presentation", className: n?.loading, "aria-live": "polite", children: ie ? ie() : "Loading..." }) : Ve ? I : /* @__PURE__ */ u("div", { role: "presentation", className: n?.empty, "aria-live": "polite", children: xe })
452
+ }
453
+ ),
454
+ oe ? /* @__PURE__ */ u("div", { className: n?.footer, children: oe }) : null
455
+ ] }) : null
456
+ ] });
457
+ }
458
+ const Qe = w(Je);
459
+ Qe.displayName = "ComboBoxBase";
460
+ export {
461
+ Ke as B,
462
+ Pe as C,
463
+ qe as I,
464
+ Ue as R,
465
+ Te as S,
466
+ ze as a,
467
+ Qe as b,
468
+ Y as c,
469
+ V as m
470
+ };
471
+ //# sourceMappingURL=ComboBox-CbLG-Ss1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboBox-CbLG-Ss1.js","sources":["../src/utils/mergeRefs.ts","../src/unstyled/Slot.tsx","../src/unstyled/Button/Button.tsx","../src/unstyled/IconButton/IconButton.tsx","../src/unstyled/Checkbox/Checkbox.tsx","../src/unstyled/Switch/Switch.tsx","../src/unstyled/RadioButton/RadioButton.tsx","../src/unstyled/Slider/Slider.tsx","../src/unstyled/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { Ref } from \"react\";\n\nexport function mergeRefs<T>(...refs: (Ref<T> | undefined)[]): (value: T | null) => void {\n return (value: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref && typeof ref === \"object\") {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n }\n };\n}\n","import {\n forwardRef,\n isValidElement,\n cloneElement,\n type ReactNode,\n type HTMLAttributes,\n type Ref,\n} from \"react\";\nimport { mergeRefs } from \"../utils/mergeRefs\";\n\nfunction mergeProps(\n slotProps: Record<string, unknown>,\n childProps: Record<string, unknown>,\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...slotProps, ...childProps };\n\n for (const key of Object.keys(slotProps)) {\n if (key === \"children\" || key === \"ref\") continue;\n\n const slotVal = slotProps[key];\n const childVal = childProps[key];\n\n // Merge event handlers\n if (typeof slotVal === \"function\" && typeof childVal === \"function\") {\n merged[key] = (...args: unknown[]) => {\n childVal(...args);\n slotVal(...args);\n };\n }\n\n // Merge className\n if (key === \"className\" && typeof slotVal === \"string\" && typeof childVal === \"string\") {\n merged[key] = `${slotVal} ${childVal}`.trim();\n }\n\n // Merge style\n if (key === \"style\" && typeof slotVal === \"object\" && typeof childVal === \"object\") {\n merged[key] = { ...(slotVal as object), ...(childVal as object) };\n }\n }\n\n return merged;\n}\n\nexport interface SlotProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n}\n\nexport const Slot = forwardRef<HTMLElement, SlotProps>(\n ({ children, ...slotProps }, forwardedRef) => {\n if (!isValidElement(children)) {\n return null;\n }\n\n const childProps = children.props as Record<string, unknown>;\n const childRef = (children as unknown as { ref?: Ref<HTMLElement> }).ref;\n\n return cloneElement(children, {\n ...mergeProps(slotProps, childProps),\n ref: mergeRefs(forwardedRef, childRef),\n } as Record<string, unknown>);\n },\n);\n\nSlot.displayName = \"Slot\";\n","import { forwardRef, type ButtonHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface ButtonBaseProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\nexport const ButtonBase = forwardRef<HTMLButtonElement, ButtonBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return <Comp ref={ref} {...props} />;\n },\n);\n\nButtonBase.displayName = \"ButtonBase\";\n","import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface IconButtonBaseProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n icon: ReactNode;\n \"aria-label\": string;\n}\n\nexport const IconButtonBase = forwardRef<HTMLButtonElement, IconButtonBaseProps>(\n ({ asChild = false, icon, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp ref={ref} {...props}>\n {icon}\n {children}\n </Comp>\n );\n },\n);\n\nIconButtonBase.displayName = \"IconButtonBase\";\n","import { forwardRef, useEffect, useRef, type InputHTMLAttributes } from \"react\";\nimport { mergeRefs } from \"../../utils/mergeRefs\";\n\nexport interface CheckboxBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n indeterminate?: boolean;\n}\n\nexport const CheckboxBase = forwardRef<HTMLInputElement, CheckboxBaseProps>(\n ({ indeterminate, ...props }, forwardedRef) => {\n const internalRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (internalRef.current) {\n internalRef.current.indeterminate = indeterminate ?? false;\n }\n }, [indeterminate]);\n\n return <input ref={mergeRefs(forwardedRef, internalRef)} type=\"checkbox\" {...props} />;\n },\n);\n\nCheckboxBase.displayName = \"CheckboxBase\";\n","import { forwardRef, type InputHTMLAttributes } from \"react\";\n\nexport interface SwitchBaseProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"role\"\n> {}\n\nexport const SwitchBase = forwardRef<HTMLInputElement, SwitchBaseProps>((props, ref) => {\n return <input ref={ref} type=\"checkbox\" role=\"switch\" {...props} />;\n});\n\nSwitchBase.displayName = \"SwitchBase\";\n","import { forwardRef, type InputHTMLAttributes } from \"react\";\n\nexport interface RadioButtonBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {}\n\nexport const RadioButtonBase = forwardRef<HTMLInputElement, RadioButtonBaseProps>((props, ref) => {\n return <input ref={ref} type=\"radio\" {...props} />;\n});\n\nRadioButtonBase.displayName = \"RadioButtonBase\";\n","import { forwardRef, type InputHTMLAttributes } from \"react\";\n\nexport interface SliderBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {}\n\nexport const SliderBase = forwardRef<HTMLInputElement, SliderBaseProps>((props, ref) => {\n return <input ref={ref} type=\"range\" {...props} />;\n});\n\nSliderBase.displayName = \"SliderBase\";\n","import {\n useState,\n useRef,\n useCallback,\n useEffect,\n useMemo,\n useId,\n forwardRef,\n type KeyboardEvent,\n type HTMLAttributes,\n type ReactNode,\n type ForwardedRef,\n type Ref,\n} from \"react\";\nimport { mergeRefs } from \"../../utils/mergeRefs\";\n\n// ─── Public Types ───\n\nexport interface ComboBoxOption<T = string> {\n value: T;\n label: string;\n group?: string;\n disabled?: boolean;\n favourite?: boolean;\n}\n\nexport interface ComboBoxRenderOptionState {\n isSelected: boolean;\n isHighlighted: boolean;\n isDisabled: boolean;\n isFavourite: boolean;\n}\n\nexport interface ComboBoxGroup<T = string> {\n label: string;\n options: ComboBoxOption<T>[];\n}\n\n/**\n * CSS class overrides that the styled layer injects into the unstyled base.\n * Every key is optional — when absent, no className is applied.\n */\nexport interface ComboBoxClassNames {\n root?: string;\n wrapper?: string;\n multiValueContainer?: string;\n pill?: string;\n pillText?: string;\n pillRemove?: string;\n singleValue?: string;\n input?: string;\n inputHidden?: string;\n indicator?: string;\n indicatorOpen?: string;\n listbox?: string;\n header?: string;\n footer?: string;\n options?: string;\n option?: string;\n optionHighlighted?: string;\n optionSelected?: string;\n optionDisabled?: string;\n optionCreate?: string;\n optionLabel?: string;\n checkIcon?: string;\n group?: string;\n groupLabel?: string;\n loading?: string;\n spinner?: string;\n empty?: string;\n}\n\nexport interface ComboBoxBaseProps<T = string> extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /** Available options. */\n options: ComboBoxOption<T>[];\n\n // ─── Value ───\n /** Selected value(s). Single value or array for multiple. */\n value?: T | T[] | null;\n /** Called when selection changes. */\n onChange?: (value: T | T[] | null) => void;\n /** Enable multi-select mode. */\n multiple?: boolean;\n\n // ─── Typeahead ───\n /** Controlled input text. */\n inputValue?: string;\n /** Called when input text changes. */\n onInputChange?: (value: string) => void;\n /** Custom filter function. Return true to keep option. */\n filterFn?: (option: ComboBoxOption<T>, inputValue: string) => boolean;\n\n // ─── Async ───\n /** Show loading indicator. */\n loading?: boolean;\n /** Called when input changes to trigger async loading. */\n onLoadOptions?: (inputValue: string) => void;\n\n // ─── Creatable ───\n /** Allow creating new options from input. */\n creatable?: boolean;\n /** Called when user creates a new option. */\n onCreateOption?: (inputValue: string) => void;\n /** Custom label for the create option. */\n formatCreateLabel?: (inputValue: string) => string;\n\n // ─── Sections ───\n /** Content rendered above the options list. */\n header?: ReactNode;\n /** Content rendered below the options list. */\n footer?: ReactNode;\n\n // ─── Display ───\n placeholder?: string;\n disabled?: boolean;\n /** Message shown when no options match. */\n noOptionsMessage?: string | ReactNode;\n\n // ─── Rendering ───\n /** Custom option renderer. */\n renderOption?: (option: ComboBoxOption<T>, state: ComboBoxRenderOptionState) => ReactNode;\n /** Custom selected value renderer (single mode). */\n renderValue?: (option: ComboBoxOption<T>) => ReactNode;\n /** Render the \"selected check\" icon beside a selected option. Return null to suppress. */\n renderCheckIcon?: () => ReactNode;\n /** Render the chevron/indicator icon. */\n renderIndicator?: (isOpen: boolean) => ReactNode;\n /** Render the pill remove button icon. */\n renderPillRemoveIcon?: () => ReactNode;\n /** Render the loading spinner content. */\n renderLoading?: () => ReactNode;\n\n // ─── Open state ───\n /** Controlled open state. */\n open?: boolean;\n /** Called when open state changes. */\n onOpenChange?: (open: boolean) => void;\n\n // ─── Style injection ───\n /** CSS class overrides injected by the styled layer. */\n classNames?: ComboBoxClassNames;\n /** Root element data attributes. */\n dataAttributes?: Record<string, string>;\n}\n\n// ─── Default filter ───\n\nfunction defaultFilter<T>(option: ComboBoxOption<T>, input: string): boolean {\n if (!input) return true;\n return option.label.toLowerCase().includes(input.toLowerCase());\n}\n\n// ─── Group options ───\n\nfunction groupOptions<T>(options: ComboBoxOption<T>[]): {\n favourites: ComboBoxOption<T>[];\n groups: ComboBoxGroup<T>[];\n ungrouped: ComboBoxOption<T>[];\n} {\n const favourites: ComboBoxOption<T>[] = [];\n const groupMap = new Map<string, ComboBoxOption<T>[]>();\n const ungrouped: ComboBoxOption<T>[] = [];\n\n for (const opt of options) {\n if (opt.favourite) {\n favourites.push(opt);\n }\n if (opt.group) {\n const list = groupMap.get(opt.group) ?? [];\n list.push(opt);\n groupMap.set(opt.group, list);\n } else {\n ungrouped.push(opt);\n }\n }\n\n const groups: ComboBoxGroup<T>[] = [];\n for (const [label, opts] of groupMap) {\n groups.push({ label, options: opts });\n }\n\n return { favourites, groups, ungrouped };\n}\n\n// ─── Utility: join class names (truthy only) ───\n\nfunction cx(...classes: (string | false | undefined | null)[]): string | undefined {\n const result = classes.filter(Boolean).join(\" \");\n return result || undefined;\n}\n\n// ─── Component ───\n\nfunction ComboBoxBaseRender<T = string>(\n {\n options,\n value,\n onChange,\n multiple = false,\n inputValue: controlledInputValue,\n onInputChange,\n filterFn,\n loading = false,\n onLoadOptions,\n creatable = false,\n onCreateOption,\n formatCreateLabel,\n header,\n footer,\n placeholder,\n disabled = false,\n noOptionsMessage = \"No options\",\n renderOption,\n renderValue,\n renderCheckIcon,\n renderIndicator,\n renderPillRemoveIcon,\n renderLoading,\n open: controlledOpen,\n onOpenChange,\n classNames: cn,\n dataAttributes,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...props\n }: ComboBoxBaseProps<T>,\n forwardedRef: ForwardedRef<HTMLInputElement>,\n): React.ReactElement {\n const id = useId();\n const listboxId = `${id}-listbox`;\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n\n // ─── Internal state ───\n const [internalInputValue, setInternalInputValue] = useState(\"\");\n const [internalOpen, setInternalOpen] = useState(false);\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n\n const isOpen = controlledOpen ?? internalOpen;\n const currentInputValue = controlledInputValue ?? internalInputValue;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (controlledOpen === undefined) {\n setInternalOpen(next);\n }\n onOpenChange?.(next);\n },\n [controlledOpen, onOpenChange],\n );\n\n const setInputValue = useCallback(\n (next: string) => {\n if (controlledInputValue === undefined) {\n setInternalInputValue(next);\n }\n onInputChange?.(next);\n },\n [controlledInputValue, onInputChange],\n );\n\n // ─── Selected values as array ───\n const selectedValues = useMemo<T[]>(() => {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n }, [value]);\n\n const isSelected = useCallback(\n (optValue: T) => selectedValues.some((v) => v === optValue),\n [selectedValues],\n );\n\n // ─── Filtered options ───\n const filter = filterFn ?? defaultFilter;\n const filteredOptions = useMemo(\n () => options.filter((opt) => filter(opt, currentInputValue)),\n [options, filter, currentInputValue],\n );\n\n // ─── Flat list for keyboard navigation ───\n const flatOptions = useMemo(() => {\n const { favourites, groups, ungrouped } = groupOptions(filteredOptions);\n const flat: ComboBoxOption<T>[] = [];\n for (const f of favourites) flat.push(f);\n for (const g of groups) {\n for (const o of g.options) {\n if (!o.favourite) flat.push(o);\n }\n }\n for (const o of ungrouped) {\n if (!o.favourite) flat.push(o);\n }\n return flat;\n }, [filteredOptions]);\n\n // Show create option?\n const showCreateOption =\n creatable &&\n currentInputValue.trim() !== \"\" &&\n !options.some((o) => o.label.toLowerCase() === currentInputValue.trim().toLowerCase());\n\n const createLabel = formatCreateLabel\n ? formatCreateLabel(currentInputValue.trim())\n : `Create \"${currentInputValue.trim()}\"`;\n\n const totalNavigable = flatOptions.length + (showCreateOption ? 1 : 0);\n\n // ─── Selection logic ───\n const selectOption = useCallback(\n (opt: ComboBoxOption<T>) => {\n if (opt.disabled) return;\n\n if (multiple) {\n const next = isSelected(opt.value)\n ? selectedValues.filter((v) => v !== opt.value)\n : [...selectedValues, opt.value];\n onChange?.(next);\n setInputValue(\"\");\n } else {\n onChange?.(opt.value);\n setInputValue(opt.label);\n setOpen(false);\n }\n\n inputRef.current?.focus();\n },\n [multiple, isSelected, selectedValues, onChange, setInputValue, setOpen],\n );\n\n const removeValue = useCallback(\n (val: T) => {\n if (!multiple) return;\n const next = selectedValues.filter((v) => v !== val);\n onChange?.(next.length > 0 ? next : null);\n inputRef.current?.focus();\n },\n [multiple, selectedValues, onChange],\n );\n\n // ─── Keyboard ───\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n if (!isOpen) {\n setOpen(true);\n setHighlightedIndex(0);\n } else {\n setHighlightedIndex((prev) => (prev + 1) % totalNavigable);\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n if (!isOpen) {\n setOpen(true);\n setHighlightedIndex(totalNavigable - 1);\n } else {\n setHighlightedIndex((prev) => (prev - 1 + totalNavigable) % totalNavigable);\n }\n break;\n }\n case \"Enter\": {\n e.preventDefault();\n if (isOpen && highlightedIndex >= 0) {\n if (highlightedIndex < flatOptions.length) {\n selectOption(flatOptions[highlightedIndex]);\n } else if (showCreateOption) {\n onCreateOption?.(currentInputValue.trim());\n setInputValue(\"\");\n }\n } else if (!isOpen) {\n setOpen(true);\n }\n break;\n }\n case \"Escape\": {\n if (isOpen) {\n e.preventDefault();\n setOpen(false);\n setHighlightedIndex(-1);\n }\n break;\n }\n case \"Backspace\": {\n if (multiple && currentInputValue === \"\" && selectedValues.length > 0) {\n removeValue(selectedValues[selectedValues.length - 1]);\n }\n break;\n }\n case \"Home\": {\n if (isOpen) {\n e.preventDefault();\n setHighlightedIndex(0);\n }\n break;\n }\n case \"End\": {\n if (isOpen) {\n e.preventDefault();\n setHighlightedIndex(totalNavigable - 1);\n }\n break;\n }\n }\n },\n [\n disabled,\n isOpen,\n setOpen,\n highlightedIndex,\n totalNavigable,\n flatOptions,\n selectOption,\n showCreateOption,\n onCreateOption,\n currentInputValue,\n setInputValue,\n multiple,\n selectedValues,\n removeValue,\n ],\n );\n\n // ─── Input change ───\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const val = e.target.value;\n setInputValue(val);\n if (!isOpen) setOpen(true);\n setHighlightedIndex(0);\n onLoadOptions?.(val);\n },\n [setInputValue, isOpen, setOpen, onLoadOptions],\n );\n\n // ─── Focus ───\n const handleFocus = useCallback(() => {\n if (!disabled && !isOpen) {\n setOpen(true);\n }\n }, [disabled, isOpen, setOpen]);\n\n // Close on outside click\n useEffect(() => {\n if (!isOpen) return;\n const handler = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false);\n setHighlightedIndex(-1);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [isOpen, setOpen]);\n\n // Scroll highlighted into view\n useEffect(() => {\n if (highlightedIndex < 0 || !listRef.current) return;\n const el = listRef.current.querySelector(`[data-index=\"${highlightedIndex}\"]`);\n if (el) {\n el.scrollIntoView?.({ block: \"nearest\" });\n }\n }, [highlightedIndex]);\n\n // ─── Grouped rendering data ───\n const { favourites, groups, ungrouped } = useMemo(\n () => groupOptions(filteredOptions),\n [filteredOptions],\n );\n\n // ─── Helper: get option id ───\n const getOptionId = (index: number) => `${id}-option-${index}`;\n\n // ─── Helper: render a single option ───\n const renderSingleOption = (opt: ComboBoxOption<T>, flatIdx: number) => {\n const state: ComboBoxRenderOptionState = {\n isSelected: isSelected(opt.value),\n isHighlighted: highlightedIndex === flatIdx,\n isDisabled: opt.disabled ?? false,\n isFavourite: opt.favourite ?? false,\n };\n\n return (\n <div\n key={`${flatIdx}-${String(opt.value)}`}\n id={getOptionId(flatIdx)}\n role=\"option\"\n tabIndex={-1}\n data-index={flatIdx}\n aria-selected={state.isSelected}\n aria-disabled={state.isDisabled || undefined}\n data-highlighted={state.isHighlighted || undefined}\n data-selected={state.isSelected || undefined}\n data-disabled={state.isDisabled || undefined}\n className={cx(\n cn?.option,\n state.isHighlighted && cn?.optionHighlighted,\n state.isSelected && cn?.optionSelected,\n state.isDisabled && cn?.optionDisabled,\n )}\n onMouseDown={(e) => {\n e.preventDefault(); // keep focus on input\n selectOption(opt);\n }}\n onMouseEnter={() => setHighlightedIndex(flatIdx)}>\n {renderOption ? (\n renderOption(opt, state)\n ) : (\n <>\n <span className={cn?.optionLabel}>{opt.label}</span>\n {state.isSelected && renderCheckIcon ? renderCheckIcon() : null}\n </>\n )}\n </div>\n );\n };\n\n // ─── Render selected values (multi mode) ───\n const renderSelectedPills = () => {\n if (!multiple) return null;\n return selectedValues.map((val) => {\n const opt = options.find((o) => o.value === val);\n if (!opt) return null;\n return (\n <span key={String(val)} className={cn?.pill} data-combobox-pill>\n <span className={cn?.pillText}>{renderValue ? renderValue(opt) : opt.label}</span>\n {!disabled ? (\n <button\n type=\"button\"\n className={cn?.pillRemove}\n tabIndex={-1}\n aria-label={`Remove ${opt.label}`}\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n removeValue(val);\n }}>\n {renderPillRemoveIcon ? renderPillRemoveIcon() : \"\\u00d7\"}\n </button>\n ) : null}\n </span>\n );\n });\n };\n\n // ─── Display value for single mode ───\n const singleDisplayValue = useMemo(() => {\n if (multiple) return currentInputValue;\n if (isOpen) return currentInputValue;\n if (value != null && !renderValue) {\n const opt = options.find((o) => o.value === value);\n if (opt) return opt.label;\n }\n return currentInputValue;\n }, [multiple, isOpen, currentInputValue, value, options, renderValue]);\n\n // Custom single value display\n const singleValueNode = useMemo(() => {\n if (multiple || isOpen || value == null || !renderValue) return null;\n const opt = options.find((o) => o.value === value);\n if (!opt) return null;\n return <span className={cn?.singleValue}>{renderValue(opt)}</span>;\n }, [multiple, isOpen, value, options, renderValue, cn?.singleValue]);\n\n // ─── Build option list sections ───\n const optionSections: ReactNode[] = [];\n let runningIndex = 0;\n\n // Favourites section\n if (favourites.length > 0) {\n optionSections.push(\n <div\n key=\"__fav-group\"\n role=\"group\"\n aria-label=\"Favourites\"\n className={cn?.group}\n data-combobox-group=\"favourites\">\n <div className={cn?.groupLabel} data-combobox-group-label aria-hidden=\"true\">\n Favourites\n </div>\n {favourites.map((opt) => {\n const node = renderSingleOption(opt, runningIndex);\n runningIndex++;\n return node;\n })}\n </div>,\n );\n }\n\n // Named groups\n for (const group of groups) {\n const nonFavOpts = group.options.filter((o) => !o.favourite);\n if (nonFavOpts.length === 0) continue;\n optionSections.push(\n <div\n key={`__group-${group.label}`}\n role=\"group\"\n aria-label={group.label}\n className={cn?.group}\n data-combobox-group={group.label}>\n <div className={cn?.groupLabel} data-combobox-group-label aria-hidden=\"true\">\n {group.label}\n </div>\n {nonFavOpts.map((opt) => {\n const node = renderSingleOption(opt, runningIndex);\n runningIndex++;\n return node;\n })}\n </div>,\n );\n }\n\n // Ungrouped (non-favourite)\n const ungroupedNonFav = ungrouped.filter((o) => !o.favourite);\n if (ungroupedNonFav.length > 0) {\n if (favourites.length > 0 || groups.length > 0) {\n optionSections.push(\n <div\n key=\"__ungrouped\"\n role=\"group\"\n aria-label=\"All\"\n className={cn?.group}\n data-combobox-group=\"all\">\n <div className={cn?.groupLabel} data-combobox-group-label aria-hidden=\"true\">\n All\n </div>\n {ungroupedNonFav.map((opt) => {\n const node = renderSingleOption(opt, runningIndex);\n runningIndex++;\n return node;\n })}\n </div>,\n );\n } else {\n for (const opt of ungroupedNonFav) {\n optionSections.push(renderSingleOption(opt, runningIndex));\n runningIndex++;\n }\n }\n }\n\n // Create option\n if (showCreateOption) {\n const createIdx = runningIndex;\n optionSections.push(\n <div\n key=\"__create\"\n id={getOptionId(createIdx)}\n role=\"option\"\n tabIndex={-1}\n data-index={createIdx}\n aria-selected={false}\n data-highlighted={highlightedIndex === createIdx || undefined}\n data-combobox-create\n className={cx(\n cn?.option,\n cn?.optionCreate,\n highlightedIndex === createIdx && cn?.optionHighlighted,\n )}\n onMouseDown={(e) => {\n e.preventDefault();\n onCreateOption?.(currentInputValue.trim());\n setInputValue(\"\");\n }}\n onMouseEnter={() => setHighlightedIndex(createIdx)}>\n {createLabel}\n </div>,\n );\n }\n\n const hasOptions = flatOptions.length > 0 || showCreateOption;\n\n // ─── Shared input props ───\n const inputProps = {\n type: \"text\" as const,\n role: \"searchbox\" as const,\n \"aria-autocomplete\": \"list\" as const,\n \"aria-controls\": isOpen ? listboxId : undefined,\n \"aria-activedescendant\":\n isOpen && highlightedIndex >= 0 ? getOptionId(highlightedIndex) : undefined,\n \"aria-label\": ariaLabel ?? placeholder,\n \"aria-labelledby\": ariaLabelledBy,\n onChange: handleInputChange,\n onKeyDown: handleKeyDown,\n onFocus: handleFocus,\n disabled,\n };\n\n return (\n <div ref={containerRef} className={cn?.root} {...dataAttributes} {...props}>\n <div\n role=\"combobox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listboxId : undefined}\n aria-haspopup=\"listbox\"\n aria-disabled={disabled || undefined}\n className={cn?.wrapper}>\n {multiple ? (\n <div className={cn?.multiValueContainer}>\n {renderSelectedPills()}\n <input\n ref={mergeRefs(forwardedRef, inputRef)}\n className={cn?.input}\n {...inputProps}\n value={currentInputValue}\n placeholder={selectedValues.length === 0 ? placeholder : undefined}\n />\n </div>\n ) : (\n <>\n {singleValueNode}\n <input\n ref={mergeRefs(forwardedRef, inputRef)}\n className={cx(cn?.input, singleValueNode ? cn?.inputHidden : undefined)}\n {...inputProps}\n value={singleDisplayValue}\n placeholder={placeholder}\n />\n </>\n )}\n {renderIndicator ? renderIndicator(isOpen) : null}\n </div>\n\n {isOpen ? (\n <div className={cn?.listbox}>\n {header ? <div className={cn?.header}>{header}</div> : null}\n\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n className={cn?.options}\n tabIndex={-1}>\n {loading ? (\n <div role=\"presentation\" className={cn?.loading} aria-live=\"polite\">\n {renderLoading ? renderLoading() : \"Loading...\"}\n </div>\n ) : !hasOptions ? (\n <div role=\"presentation\" className={cn?.empty} aria-live=\"polite\">\n {noOptionsMessage}\n </div>\n ) : (\n optionSections\n )}\n </div>\n\n {footer ? <div className={cn?.footer}>{footer}</div> : null}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport const ComboBoxBase = forwardRef(ComboBoxBaseRender) as <T = string>(\n props: ComboBoxBaseProps<T> & { ref?: Ref<HTMLInputElement> },\n) => React.ReactElement | null;\n\n(ComboBoxBase as { displayName?: string }).displayName = \"ComboBoxBase\";\n"],"names":["mergeRefs","refs","value","ref","mergeProps","slotProps","childProps","merged","key","slotVal","childVal","args","Slot","forwardRef","children","forwardedRef","isValidElement","childRef","cloneElement","ButtonBase","asChild","props","jsx","IconButtonBase","icon","jsxs","CheckboxBase","indeterminate","internalRef","useRef","useEffect","SwitchBase","RadioButtonBase","SliderBase","defaultFilter","option","input","groupOptions","options","favourites","groupMap","ungrouped","opt","list","groups","label","opts","cx","classes","ComboBoxBaseRender","onChange","multiple","controlledInputValue","onInputChange","filterFn","loading","onLoadOptions","creatable","onCreateOption","formatCreateLabel","header","footer","placeholder","disabled","noOptionsMessage","renderOption","renderValue","renderCheckIcon","renderIndicator","renderPillRemoveIcon","renderLoading","controlledOpen","onOpenChange","cn","dataAttributes","ariaLabel","ariaLabelledBy","id","useId","listboxId","inputRef","listRef","containerRef","internalInputValue","setInternalInputValue","useState","internalOpen","setInternalOpen","highlightedIndex","setHighlightedIndex","isOpen","currentInputValue","setOpen","useCallback","next","setInputValue","selectedValues","useMemo","isSelected","optValue","v","filter","filteredOptions","flatOptions","flat","f","g","o","showCreateOption","createLabel","totalNavigable","selectOption","removeValue","val","handleKeyDown","prev","handleInputChange","handleFocus","handler","e","el","getOptionId","index","renderSingleOption","flatIdx","state","Fragment","renderSelectedPills","singleDisplayValue","singleValueNode","optionSections","runningIndex","node","group","nonFavOpts","ungroupedNonFav","createIdx","hasOptions","inputProps","ComboBoxBase"],"mappings":";;AAEO,SAASA,KAAgBC,GAAyD;AACvF,SAAO,CAACC,MAAoB;AAC1B,eAAWC,KAAOF;AAChB,MAAI,OAAOE,K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CAAQ;AAAA,gBACrC,WAAWjC,EAAG0B,GAAI,OAAOwD,KAAkBxD,GAAI,cAAc,MAAS;AAAA,gBACrE,GAAGiE;AAAA,gBACJ,OAAOV;AAAA,gBACP,aAAAlE;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,GACF;AAAA,UAEDM,KAAkBA,GAAgBsB,CAAM,IAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAG9CA,IACC,gBAAAjE,EAAC,OAAA,EAAI,WAAWgD,GAAI,SACjB,UAAA;AAAA,MAAAb,uBAAU,OAAA,EAAI,WAAWa,GAAI,QAAS,cAAO,IAAS;AAAA,MAEvD,gBAAAnD;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAK2D;AAAA,UACL,IAAIF;AAAA,UACJ,MAAK;AAAA,UACL,wBAAsB5B,KAAY;AAAA,UAClC,WAAWsB,GAAI;AAAA,UACf,UAAU;AAAA,UACT,UAAAlB,KACC,gBAAAjC,EAAC,OAAA,EAAI,MAAK,gBAAe,WAAWmD,GAAI,SAAS,aAAU,UACxD,UAAAH,KAAgBA,GAAA,IAAkB,aAAA,CACrC,IACGmE,KAKHP,IAJA,gBAAA5G,EAAC,OAAA,EAAI,MAAK,gBAAe,WAAWmD,GAAI,OAAO,aAAU,UACtD,UAAAT,GAAA,CACH;AAAA,QAEA;AAAA,MAAA;AAAA,MAIHH,KAAS,gBAAAvC,EAAC,OAAA,EAAI,WAAWmD,GAAI,QAAS,cAAO,IAAS;AAAA,IAAA,EAAA,CACzD,IACE;AAAA,EAAA,GACN;AAEJ;AAEO,MAAMkE,KAAe9H,EAAWoC,EAAkB;AAIxD0F,GAA0C,cAAc;"}
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function CheckIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function ChevronDownIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function CloseIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function CloseSmallIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function DashIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function MinusIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function PlusIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function SpinnerIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare function UploadIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ export { CheckIcon } from './CheckIcon';
2
+ export { DashIcon } from './DashIcon';
3
+ export { CloseSmallIcon } from './CloseSmallIcon';
4
+ export { CloseIcon } from './CloseIcon';
5
+ export { ChevronDownIcon } from './ChevronDownIcon';
6
+ export { UploadIcon } from './UploadIcon';
7
+ export { SpinnerIcon } from './SpinnerIcon';
8
+ export { MinusIcon } from './MinusIcon';
9
+ export { PlusIcon } from './PlusIcon';
@@ -0,0 +1,36 @@
1
+ import { HTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import { ValidationStatus } from '../Input/Input';
4
+ import { ComboBoxOption, ComboBoxRenderOptionState } from '../../unstyled/ComboBox/ComboBox';
5
+ export type { ComboBoxOption, ComboBoxRenderOptionState, ComboBoxGroup, } from '../../unstyled/ComboBox/ComboBox';
6
+ declare const wrapperVariants: (props?: ({
7
+ variant?: "primary" | "secondary" | "tertiary" | null | undefined;
8
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
9
+ export interface ComboBoxProps<T = string> extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, VariantProps<typeof wrapperVariants> {
10
+ options: ComboBoxOption<T>[];
11
+ value?: T | T[] | null;
12
+ onChange?: (value: T | T[] | null) => void;
13
+ multiple?: boolean;
14
+ inputValue?: string;
15
+ onInputChange?: (value: string) => void;
16
+ filterFn?: (option: ComboBoxOption<T>, inputValue: string) => boolean;
17
+ loading?: boolean;
18
+ onLoadOptions?: (inputValue: string) => void;
19
+ creatable?: boolean;
20
+ onCreateOption?: (inputValue: string) => void;
21
+ formatCreateLabel?: (inputValue: string) => string;
22
+ header?: ReactNode;
23
+ footer?: ReactNode;
24
+ placeholder?: string;
25
+ disabled?: boolean;
26
+ validationStatus?: ValidationStatus;
27
+ fullWidth?: boolean;
28
+ noOptionsMessage?: string | ReactNode;
29
+ renderOption?: (option: ComboBoxOption<T>, state: ComboBoxRenderOptionState) => ReactNode;
30
+ renderValue?: (option: ComboBoxOption<T>) => ReactNode;
31
+ open?: boolean;
32
+ onOpenChange?: (open: boolean) => void;
33
+ }
34
+ export declare const ComboBox: <T = string>(props: ComboBoxProps<T> & {
35
+ ref?: Ref<HTMLInputElement>;
36
+ }) => React.ReactElement | null;