@spear-ai/spectral 1.11.2 → 1.11.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/dist/Combobox.js CHANGED
@@ -3,136 +3,141 @@ import "./styles/main.css";
3
3
  import { ChevronDownIcon as e } from "./Icons/ChevronDownIcon.js";
4
4
  import { LoaderIcon as t } from "./Icons/LoaderIcon.js";
5
5
  import { t as n } from "./twUtils-VNWgstKL.js";
6
- import { EmptyState as ee, ErrorMessage as r, LoadingState as te, WarningMessage as ne, getAriaProps as re, getDropdownSurfaceClasses as ie, getErrorMessageId as ae, getFormFieldCSSProperties as oe, getOptionClasses as i, getTriggerClasses as a, useFormFieldId as o, useFormFieldState as s } from "./utils/formFieldUtils.js";
7
- import { useUncontrolledState as c } from "./hooks/useUncontrolledState.js";
8
- import { Label as l } from "./Label.js";
9
- import { InputGroup as u, InputGroupAddon as d } from "./primitives/input-group.js";
10
- import { a as f, i as p, n as m, o as h } from "./ComboboxBase-qX-mQhT6.js";
11
- import { useCallback as g, useRef as _, useState as v } from "react";
12
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
6
+ import { EmptyState as ee, ErrorMessage as te, LoadingState as ne, WarningMessage as re, getAriaProps as ie, getDropdownSurfaceClasses as ae, getErrorMessageId as oe, getFormFieldCSSProperties as se, getOptionClasses as ce, getTriggerClasses as r, useFormFieldId as i, useFormFieldState as a } from "./utils/formFieldUtils.js";
7
+ import { useUncontrolledState as o } from "./hooks/useUncontrolledState.js";
8
+ import { Label as s } from "./Label.js";
9
+ import { InputGroup as c, InputGroupAddon as l } from "./primitives/input-group.js";
10
+ import { useAutoDropdownHorizontalShift as u } from "./utils/dropdownPositioning.js";
11
+ import { a as d, i as f, n as p, o as m } from "./ComboboxBase-qX-mQhT6.js";
12
+ import { useCallback as le, useRef as h, useState as g } from "react";
13
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
14
  //#region src/components/Combobox/Combobox.tsx
14
- var x = ({ className: x, disabled: se, defaultValue: ce = "", dropdownWidth: S = "trigger", emptyMessage: C = "No options found.", errorMessage: w, id: T, label: E, labelClassName: D, loadingMessage: O = "Loading…", name: k, onValueChange: A, options: j = [], placeholder: M = "Search…", ref: N, required: P, state: F = "default", value: I, warningMessage: L, "aria-describedby": R, "aria-label": z }) => {
15
- process.env.NODE_ENV !== "production" && !E && !z && console.warn("Combobox: provide either `label` or `aria-label` for an accessible name.");
16
- let B = _(null), V = _(null), H = o(T, k), U = `${H}-listbox`, W = ae(H), G = `${H}-warning`, le = F === "error" ? W : F === "warning" && L ? G : void 0, { isDisabled: K, isLoading: q, isInvalid: ue } = s(se, F), de = re(F, R, P, le), [J, Y] = v(!1), [fe, X] = v(""), [Z, pe] = c({
17
- value: I,
18
- defaultValue: ce,
19
- onChange: A
20
- }), me = j.find((e) => e.value === Z), Q = S === "trigger" || S === "content" ? S : "custom", $ = {
15
+ var y = ({ className: y, disabled: ue, defaultValue: de = "", dropdownWidth: b = "trigger", emptyMessage: x = "No options found.", errorMessage: S, id: C, label: w, labelClassName: T, loadingMessage: E = "Loading…", name: D, onValueChange: O, options: k = [], placeholder: A = "Search…", ref: j, required: M, state: N = "default", value: P, warningMessage: F, "aria-describedby": I, "aria-label": L }) => {
16
+ process.env.NODE_ENV !== "production" && !w && !L && console.warn("Combobox: provide either `label` or `aria-label` for an accessible name.");
17
+ let R = h(null), z = h(null), B = i(C, D), V = `${B}-listbox`, H = oe(B), U = `${B}-warning`, fe = N === "error" ? H : N === "warning" && F ? U : void 0, { isDisabled: W, isLoading: G, isInvalid: pe } = a(ue, N), me = ie(N, I, M, fe), [K, q] = g(!1), { dropdownShiftStyle: he, setDropdownElement: ge } = u(K), [J, Y] = g(""), [X, _e] = o({
18
+ value: P,
19
+ defaultValue: de,
20
+ onChange: O
21
+ }), Z = k.find((e) => e.value === X), ve = !!(Z && J.length === 0), Q = b === "trigger" || b === "content" ? b : "custom", $ = {
21
22
  maxWidth: "calc(100vw - 2rem)",
22
23
  overflowX: "auto",
23
24
  overflowY: "auto"
24
- }, he = S === "trigger" ? { width: "100%" } : S === "content" ? {
25
+ }, ye = b === "trigger" ? { width: "100%" } : b === "content" ? {
25
26
  minWidth: "max-content",
26
27
  width: "max-content",
27
28
  ...$
28
29
  } : {
29
- width: S,
30
+ width: b,
30
31
  ...$
31
- }, ge = (e) => {
32
- pe(e === Z ? "" : e), X(""), Y(!1);
33
- }, _e = (e) => {
34
- e.key === "Escape" && Y(!1);
35
- }, ve = g(() => {
32
+ }, be = (e) => {
33
+ _e(e === X ? "" : e), Y(""), q(!1);
34
+ }, xe = (e) => {
35
+ e.key === "Escape" && q(!1);
36
+ }, Se = le(() => {
36
37
  requestAnimationFrame(() => {
37
- V.current?.contains(document.activeElement) || (Y(!1), X(""));
38
+ z.current?.contains(document.activeElement) || (q(!1), Y(""));
38
39
  });
39
- }, []), ye = () => {
40
- K || q || (B.current?.focus(), Y(!0));
41
- }, be = () => q ? /* @__PURE__ */ y("div", {
42
- id: U,
40
+ }, []), Ce = () => {
41
+ W || G || (R.current?.focus(), q(!0));
42
+ }, we = () => G ? /* @__PURE__ */ _("div", {
43
+ id: V,
43
44
  role: "listbox",
44
- children: /* @__PURE__ */ y(te, { message: O })
45
- }) : j.length === 0 ? /* @__PURE__ */ y("div", {
46
- id: U,
45
+ children: /* @__PURE__ */ _(ne, { message: E })
46
+ }) : k.length === 0 ? /* @__PURE__ */ _("div", {
47
+ id: V,
47
48
  role: "listbox",
48
- children: /* @__PURE__ */ y(ee, { message: C })
49
- }) : /* @__PURE__ */ b(f, {
50
- id: U,
51
- children: [/* @__PURE__ */ y(m, { children: C }), j.map((e) => /* @__PURE__ */ y(p, {
52
- className: n(i(!!e.disabled, !1, Z === e.value), "group/command-item relative flex w-full items-center data-[selected=true]:bg-input-bg--hover"),
53
- "data-checked": Z === e.value || void 0,
49
+ children: /* @__PURE__ */ _(ee, { message: x })
50
+ }) : /* @__PURE__ */ v(d, {
51
+ id: V,
52
+ children: [/* @__PURE__ */ _(p, { children: x }), k.map((e) => /* @__PURE__ */ _(f, {
53
+ className: n(ce(!!e.disabled, !1, X === e.value), "group/command-item relative flex w-full items-center data-[selected=true]:bg-input-bg--hover"),
54
+ "data-checked": X === e.value || void 0,
54
55
  disabled: e.disabled,
55
56
  onMouseDown: (e) => e.preventDefault(),
56
- onSelect: () => ge(e.value),
57
+ onSelect: () => be(e.value),
57
58
  value: e.label,
58
- children: /* @__PURE__ */ y("span", {
59
+ children: /* @__PURE__ */ _("span", {
59
60
  className: "min-w-0 flex-1 truncate whitespace-nowrap",
60
61
  children: e.label
61
62
  })
62
63
  }, e.value))]
63
64
  });
64
- return /* @__PURE__ */ b("div", {
65
+ return /* @__PURE__ */ v("div", {
65
66
  className: "w-full",
66
- ref: N,
67
+ ref: j,
67
68
  children: [
68
- k && /* @__PURE__ */ y("input", {
69
+ D && /* @__PURE__ */ _("input", {
69
70
  type: "hidden",
70
- name: k,
71
- value: Z,
72
- disabled: K
71
+ name: D,
72
+ value: X,
73
+ disabled: W
73
74
  }),
74
- E && /* @__PURE__ */ y(l, {
75
- className: n("mb-2 block text-text-primary", D, K && "text-text-secondary"),
75
+ w && /* @__PURE__ */ _(s, {
76
+ className: n("mb-2 block text-text-primary", T, W && "text-text-secondary"),
76
77
  "data-testid": "spectral-combobox-label",
77
- htmlFor: H,
78
- children: E
78
+ htmlFor: B,
79
+ children: w
79
80
  }),
80
- /* @__PURE__ */ b(h, {
81
- ref: V,
82
- label: z ?? E,
83
- onKeyDown: _e,
81
+ /* @__PURE__ */ v(m, {
82
+ ref: z,
83
+ label: L ?? w,
84
+ onKeyDown: xe,
84
85
  className: "relative w-full",
85
- children: [/* @__PURE__ */ b(u, {
86
+ children: [/* @__PURE__ */ v(c, {
86
87
  "data-slot": "combobox-content",
87
- "data-state": F,
88
+ "data-state": N,
88
89
  "data-testid": "spectral-combobox-trigger",
89
- className: n(a(J, F), "ring-0!", K && "pointer-events-none cursor-not-allowed", x),
90
- onClick: ye,
91
- style: oe(),
92
- children: [/* @__PURE__ */ y(h.Input, {
93
- ref: B,
90
+ className: n(r(K, N), "ring-0!", W && "pointer-events-none cursor-not-allowed", y),
91
+ onClick: Ce,
92
+ style: se(),
93
+ children: [/* @__PURE__ */ _(m.Input, {
94
+ ref: R,
94
95
  autoComplete: "off",
95
96
  "data-slot": "input-group-control",
96
- "aria-controls": U,
97
- "aria-expanded": J,
98
- "aria-label": z ?? E,
99
- className: "min-w-0 px-3 py-1 text-base flex-1 truncate overflow-hidden border-0 bg-transparent whitespace-nowrap text-input-text outline-hidden placeholder:text-input-text! placeholder:opacity-100 focus-visible:ring-0 focus-visible:outline-none",
100
- disabled: K,
101
- id: H,
102
- onBlur: ve,
103
- onFocus: () => !K && !q && Y(!0),
104
- onValueChange: X,
105
- placeholder: me?.label ?? M,
97
+ "aria-controls": V,
98
+ "aria-expanded": K,
99
+ "aria-label": L ?? w,
100
+ className: n("min-w-0 px-3 py-1 text-base flex-1 truncate overflow-hidden border-0 bg-transparent whitespace-nowrap text-input-text outline-hidden placeholder:opacity-100 focus-visible:ring-0 focus-visible:outline-none", ve ? "placeholder:text-input-text!" : "placeholder:text-input-text-placeholder!"),
101
+ disabled: W,
102
+ id: B,
103
+ onBlur: Se,
104
+ onFocus: () => !W && !G && q(!0),
105
+ onValueChange: Y,
106
+ placeholder: Z?.label ?? A,
106
107
  role: "combobox",
107
- value: fe,
108
- ...de
109
- }), /* @__PURE__ */ y(d, {
108
+ value: J,
109
+ ...me
110
+ }), /* @__PURE__ */ _(l, {
110
111
  align: "inline-end",
111
112
  className: "cursor-pointer",
112
- children: q ? /* @__PURE__ */ y(t, { className: "size-5 motion-safe:animate-spin" }) : /* @__PURE__ */ y(e, { className: n("size-5 shrink-0 transition-transform duration-200", J && "rotate-180") })
113
+ children: G ? /* @__PURE__ */ _(t, { className: "size-5 motion-safe:animate-spin" }) : /* @__PURE__ */ _(e, { className: n("size-5 shrink-0 transition-transform duration-200", K && "rotate-180") })
113
114
  })]
114
- }), /* @__PURE__ */ y("div", {
115
- className: n("left-0 mt-1 p-1 absolute top-full z-50 w-full", ie(), "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:zoom-in-95", !J && "hidden"),
115
+ }), /* @__PURE__ */ _("div", {
116
+ className: n("left-0 mt-1 p-1 absolute top-full z-50 w-full", ae(), "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:zoom-in-95", !K && "hidden"),
116
117
  "data-dropdown-width-mode": Q,
117
- "data-dropdown-width-value": Q === "custom" ? S : void 0,
118
+ "data-dropdown-width-value": Q === "custom" ? b : void 0,
118
119
  "data-testid": "spectral-combobox-content",
119
- style: he,
120
- children: be()
120
+ ref: ge,
121
+ style: {
122
+ ...ye,
123
+ ...he
124
+ },
125
+ children: we()
121
126
  })]
122
127
  }),
123
- ue && w && /* @__PURE__ */ y(r, {
128
+ pe && S && /* @__PURE__ */ _(te, {
124
129
  dataTestId: "spectral-combobox-error-message",
125
- id: W,
126
- message: w
130
+ id: H,
131
+ message: S
127
132
  }),
128
- F === "warning" && L && /* @__PURE__ */ y(ne, {
133
+ N === "warning" && F && /* @__PURE__ */ _(re, {
129
134
  dataTestId: "spectral-combobox-warning-message",
130
- id: G,
131
- message: L
135
+ id: U,
136
+ message: F
132
137
  })
133
138
  ]
134
139
  });
135
140
  };
136
- x.displayName = "Combobox";
141
+ y.displayName = "Combobox";
137
142
  //#endregion
138
- export { x as Combobox };
143
+ export { y as Combobox };
@@ -81,7 +81,7 @@ var g = "placeholder:text-small! [appearance:textfield] [&::-webkit-inner-spin-b
81
81
  id: B ? L : void 0,
82
82
  style: R ? { minWidth: R } : void 0,
83
83
  children: /* @__PURE__ */ m(c, {
84
- className: "min-w-0 block max-w-full truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text!",
84
+ className: "min-w-0 block max-w-full truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text-placeholder!",
85
85
  placeholder: j
86
86
  })
87
87
  });
@@ -8,17 +8,18 @@ import { SearchIcon as i } from "../Icons/SearchIcon.js";
8
8
  import { t as a } from "../twUtils-VNWgstKL.js";
9
9
  import { ErrorMessage as o, getDropdownSurfaceClasses as s } from "../utils/formFieldUtils.js";
10
10
  import { useUncontrolledState as c } from "../hooks/useUncontrolledState.js";
11
- import { a as l, i as u, n as d, r as f } from "../dist-BtdmHAzK.js";
12
- import { useCallback as p, useEffect as ee, useId as m, useMemo as h, useRef as te, useState as g } from "react";
13
- import { Fragment as ne, jsx as _, jsxs as v } from "react/jsx-runtime";
11
+ import { useAutoDropdownHorizontalShift as l } from "../utils/dropdownPositioning.js";
12
+ import { a as u, i as d, n as f, r as ee } from "../dist-BtdmHAzK.js";
13
+ import { useCallback as p, useEffect as te, useId as ne, useMemo as m, useRef as re, useState as h } from "react";
14
+ import { Fragment as ie, jsx as g, jsxs as _ } from "react/jsx-runtime";
14
15
  //#region src/components/MultiSelect/MultiSelectBase.tsx
15
- var re = "h-4 w-4", y = (e) => ({
16
+ var v = "h-4 w-4", y = (e) => ({
16
17
  error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
17
18
  loading: "cursor-wait border-input-border--disabled",
18
19
  disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
19
20
  default: ""
20
- })[e], ie = (e, t, n) => a("min-h-12 rounded-lg px-4 py-2 text-sm flex max-h-[5.5rem] w-full items-center justify-between border border-input-border bg-input-bg", "hover:border-input-border--hover focus-visible:border-input-border--focus", "focus:outline-none focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-accent", "disabled:cursor-not-allowed disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:opacity-50", "overflow-hidden text-input-text transition duration-200", t && "border-input-border--focus", y(e), n), ae = () => a("max-h-80 z-50 overflow-hidden", s(), "motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0", "motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95", "motion-safe:data-[side=bottom]:slide-in-from-top-2", "motion-safe:data-[side=top]:slide-in-from-bottom-2", "origin-(--radix-popover-content-transform-origin)"), oe = (e, t, n, r, i, a, o, s, c) => {
21
- let [l, u] = g(-1), d = h(() => {
21
+ })[e], b = (e, t, n) => a("min-h-12 rounded-lg px-4 py-2 text-sm flex max-h-[5.5rem] w-full items-center justify-between border border-input-border bg-input-bg", "hover:border-input-border--hover focus-visible:border-input-border--focus", "focus:outline-none focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-accent", "disabled:cursor-not-allowed disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:opacity-50", "overflow-hidden text-input-text transition duration-200", t && "border-input-border--focus", y(e), n), ae = () => a("max-h-80 z-50 overflow-hidden", s(), "motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0", "motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95", "motion-safe:data-[side=bottom]:slide-in-from-top-2", "motion-safe:data-[side=top]:slide-in-from-bottom-2", "origin-(--radix-popover-content-transform-origin)"), oe = (e, t, n, r, i, a, o, s, c) => {
22
+ let [l, u] = h(-1), d = m(() => {
22
23
  let t = [];
23
24
  return o && t.push({ type: "search" }), s && t.push({ type: "select-all" }), e.forEach((e, n) => {
24
25
  e.disabled || t.push({
@@ -97,23 +98,23 @@ var re = "h-4 w-4", y = (e) => ({
97
98
  let t = d[l];
98
99
  return t.type === "option" && t.index === e;
99
100
  }, [l, d]),
100
- isSearchFocused: h(() => l < 0 || l >= d.length ? !1 : d[l].type === "search", [l, d]),
101
- isSelectAllFocused: h(() => l < 0 || l >= d.length ? !1 : d[l].type === "select-all", [l, d]),
102
- isClearAllFocused: h(() => l < 0 || l >= d.length ? !1 : d[l].type === "clear-all", [l, d])
101
+ isSearchFocused: m(() => l < 0 || l >= d.length ? !1 : d[l].type === "search", [l, d]),
102
+ isSelectAllFocused: m(() => l < 0 || l >= d.length ? !1 : d[l].type === "select-all", [l, d]),
103
+ isClearAllFocused: m(() => l < 0 || l >= d.length ? !1 : d[l].type === "clear-all", [l, d])
103
104
  };
104
- }, b = ({ className: s, clearAllLabel: y = "Clear all", closeOnSelect: b = !1, dropdownWidth: x = "trigger", emptyMessage: se = "No options found", errorMessage: S, defaultValue: ce = [], id: C, label: le, loadingMessage: ue = "Loading options…", maxCount: w = 3, name: T, onChange: de, options: E = [], placeholder: D = "Select options", ref: O, searchPlaceholder: fe = "Search options…", selectAllLabel: pe = "Select all", showClearAll: me = !0, showSearch: k = !0, showSelectAll: A = !0, sortAlphabetically: j = !1, state: M = "default", value: he, "aria-label": ge, "aria-describedby": _e, ...N }) => {
105
- let P = m(), F = C ?? `${T}-${P}`, I = `${F}-listbox`, L = `${F}-error`, [R, z] = g(!1), [B, ve] = g(""), [V, H] = c({
106
- value: he,
105
+ }, x = ({ className: s, clearAllLabel: y = "Clear all", closeOnSelect: x = !1, dropdownWidth: S = "trigger", emptyMessage: se = "No options found", errorMessage: C, defaultValue: ce = [], id: le, label: ue, loadingMessage: de = "Loading options…", maxCount: w = 3, name: T, onChange: fe, options: E = [], placeholder: D = "Select options", ref: pe, searchPlaceholder: me = "Search options…", selectAllLabel: he = "Select all", showClearAll: ge = !0, showSearch: O = !0, showSelectAll: k = !0, sortAlphabetically: A = !1, state: j = "default", value: _e, "aria-label": ve, "aria-describedby": M, ...N }) => {
106
+ let P = ne(), F = le ?? `${T}-${P}`, I = `${F}-listbox`, L = `${F}-error`, [R, z] = h(!1), { dropdownShiftStyle: ye, setDropdownElement: be } = l(R), [B, xe] = h(""), [V, H] = c({
107
+ value: _e,
107
108
  defaultValue: ce,
108
- onChange: de
109
- }), U = te(null), W = N.disabled ?? M === "disabled", ye = M === "loading", be = M === "error", xe = x === "trigger" ? "var(--radix-popover-trigger-width)" : x === "content" ? "max-content" : x, G = x === "trigger" || x === "content" ? x : "custom", K = h(() => {
109
+ onChange: fe
110
+ }), U = re(null), W = N.disabled ?? j === "disabled", Se = j === "loading", Ce = j === "error", we = S === "trigger" ? "var(--radix-popover-trigger-width)" : S === "content" ? "max-content" : S, G = S === "trigger" || S === "content" ? S : "custom", K = m(() => {
110
111
  let e = E.filter((e) => e.label.toLowerCase().includes(B.toLowerCase()));
111
- return j && (e = [...e].sort((e, t) => e.label.localeCompare(t.label))), e;
112
+ return A && (e = [...e].sort((e, t) => e.label.localeCompare(t.label))), e;
112
113
  }, [
113
114
  E,
114
115
  B,
115
- j
116
- ]), q = h(() => {
116
+ A
117
+ ]), q = m(() => {
117
118
  let e = {}, t = [];
118
119
  return K.forEach((n) => {
119
120
  n.group ? (e[n.group] || (e[n.group] = []), e[n.group].push(n)) : t.push(n);
@@ -123,9 +124,9 @@ var re = "h-4 w-4", y = (e) => ({
123
124
  hasGroups: Object.keys(e).length > 0
124
125
  };
125
126
  }, [K]), J = p((e) => {
126
- E.find((t) => t.value === e)?.disabled || (H(V.includes(e) ? V.filter((t) => t !== e) : [...V, e]), b && z(!1));
127
+ E.find((t) => t.value === e)?.disabled || (H(V.includes(e) ? V.filter((t) => t !== e) : [...V, e]), x && z(!1));
127
128
  }, [
128
- b,
129
+ x,
129
130
  E,
130
131
  H,
131
132
  V
@@ -138,28 +139,28 @@ var re = "h-4 w-4", y = (e) => ({
138
139
  V
139
140
  ]), X = p(() => {
140
141
  H([]);
141
- }, [H]), Z = h(() => E.filter((e) => !e.disabled).map((e) => e.value), [E]), Se = Z.length > 0 && Z.every((e) => V.includes(e)), { getOptionFocusIndex: Ce, handleKeyDown: we, isSelectAllFocused: Te, setFocusedIndex: Q } = oe(K, X, () => z(!1), J, Y, U, k, A, !1);
142
- ee(() => {
142
+ }, [H]), Z = m(() => E.filter((e) => !e.disabled).map((e) => e.value), [E]), Te = Z.length > 0 && Z.every((e) => V.includes(e)), { getOptionFocusIndex: Ee, handleKeyDown: De, isSelectAllFocused: Oe, setFocusedIndex: Q } = oe(K, X, () => z(!1), J, Y, U, O, k, !1);
143
+ te(() => {
143
144
  Q(R ? 0 : -1);
144
145
  }, [R, Q]);
145
- let Ee = p((e) => {
146
- ve(e.target.value);
147
- }, []), De = () => {
148
- if (V.length === 0) return /* @__PURE__ */ _("span", {
146
+ let ke = p((e) => {
147
+ xe(e.target.value);
148
+ }, []), Ae = () => {
149
+ if (V.length === 0) return /* @__PURE__ */ g("span", {
149
150
  className: "min-h-8 flex items-center text-input-text-placeholder",
150
151
  children: D
151
152
  });
152
153
  let e = V.slice(0, w), t = V.length - w;
153
- return /* @__PURE__ */ v("div", {
154
+ return /* @__PURE__ */ _("div", {
154
155
  className: "gap-1 flex flex-wrap items-center overflow-hidden",
155
156
  children: [e.map((e) => {
156
157
  let t = E.find((t) => t.value === e);
157
- return t ? /* @__PURE__ */ v("span", {
158
+ return t ? /* @__PURE__ */ _("span", {
158
159
  className: "gap-1 px-2 py-1 rounded-md text-xs max-w-48 inline-flex items-center bg-input-bg--selected text-input-text",
159
- children: [/* @__PURE__ */ _("span", {
160
+ children: [/* @__PURE__ */ g("span", {
160
161
  className: "truncate",
161
162
  children: t.label
162
- }), /* @__PURE__ */ _("button", {
163
+ }), /* @__PURE__ */ g("button", {
163
164
  "aria-label": `Remove ${t.label}`,
164
165
  className: "hover:text-danger rounded-sm cursor-pointer",
165
166
  "data-testid": "spectral-multiselect-remove-item-button",
@@ -170,10 +171,10 @@ var re = "h-4 w-4", y = (e) => ({
170
171
  e.stopPropagation();
171
172
  },
172
173
  type: "button",
173
- children: /* @__PURE__ */ _(n, { size: 12 })
174
+ children: /* @__PURE__ */ g(n, { size: 12 })
174
175
  })]
175
176
  }, e) : null;
176
- }), t > 0 && /* @__PURE__ */ v("span", {
177
+ }), t > 0 && /* @__PURE__ */ _("span", {
177
178
  className: "text-input-text-secondary text-xs py-1 flex items-center",
178
179
  children: [
179
180
  "+",
@@ -184,66 +185,66 @@ var re = "h-4 w-4", y = (e) => ({
184
185
  });
185
186
  }, $ = (t, n) => {
186
187
  let r = V.includes(t.value);
187
- return /* @__PURE__ */ v("button", {
188
- className: a("gap-3 px-3 py-2 text-sm flex w-full items-center text-left hover:bg-input-bg--hover focus-visible:bg-input-bg--hover focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", Ce(n) && "bg-input-bg--hover", r && "font-medium text-input-text"),
188
+ return /* @__PURE__ */ _("button", {
189
+ className: a("gap-3 px-3 py-2 text-sm flex w-full items-center text-left hover:bg-input-bg--hover focus-visible:bg-input-bg--hover focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", Ee(n) && "bg-input-bg--hover", r && "font-medium text-input-text"),
189
190
  disabled: t.disabled,
190
191
  onClick: () => J(t.value),
191
192
  type: "button",
192
- children: [/* @__PURE__ */ _("div", {
193
+ children: [/* @__PURE__ */ g("div", {
193
194
  "data-testid": "spectral-multiselect-selected-indicator",
194
195
  className: a("w-4 h-4 rounded flex items-center justify-center border border-input-border", r && "bg-primary border-primary"),
195
- children: r && /* @__PURE__ */ _(e, { size: 12 })
196
- }), /* @__PURE__ */ _("span", { children: t.label })]
196
+ children: r && /* @__PURE__ */ g(e, { size: 12 })
197
+ }), /* @__PURE__ */ g("span", { children: t.label })]
197
198
  }, t.value);
198
- }, Oe = () => ({
199
+ }, je = () => ({
199
200
  "--multiselect-border-radius": "0.5rem",
200
201
  "--multiselect-trigger-height": "3rem",
201
202
  "--multiselect-dropdown-max-height": "20rem"
202
203
  });
203
- return /* @__PURE__ */ v("div", {
204
+ return /* @__PURE__ */ _("div", {
204
205
  className: "w-full",
205
206
  "data-testid": "spectral-multiselect-root",
206
- children: [/* @__PURE__ */ _(u, {
207
+ children: [/* @__PURE__ */ g(d, {
207
208
  open: R,
208
209
  onOpenChange: z,
209
- children: /* @__PURE__ */ v("div", {
210
+ children: /* @__PURE__ */ _("div", {
210
211
  className: "relative",
211
212
  "data-testid": "spectral-multiselect-wrapper",
212
- onKeyDown: R ? we : void 0,
213
+ onKeyDown: R ? De : void 0,
213
214
  role: "none",
214
215
  children: [
215
- /* @__PURE__ */ _(l, {
216
+ /* @__PURE__ */ g(u, {
216
217
  asChild: !0,
217
- children: /* @__PURE__ */ v("button", {
218
+ children: /* @__PURE__ */ _("button", {
218
219
  "aria-controls": R ? I : void 0,
219
- "aria-describedby": [be ? L : null, _e].filter(Boolean).join(" ") || void 0,
220
+ "aria-describedby": [Ce ? L : null, M].filter(Boolean).join(" ") || void 0,
220
221
  "aria-expanded": R,
221
- "aria-label": ge ?? le,
222
- className: ie(M, R, s),
223
- "data-state": M,
222
+ "aria-label": ve ?? ue,
223
+ className: b(j, R, s),
224
+ "data-state": j,
224
225
  "data-testid": "spectral-multiselect-trigger",
225
226
  disabled: W,
226
227
  id: F,
227
228
  name: T,
228
- ref: O,
229
+ ref: pe,
229
230
  role: "combobox",
230
- style: Oe(),
231
+ style: je(),
231
232
  type: "button",
232
233
  ...N,
233
- children: [/* @__PURE__ */ _("div", {
234
+ children: [/* @__PURE__ */ g("div", {
234
235
  className: "min-w-0 flex-1 overflow-hidden",
235
236
  "data-testid": "spectral-multiselect-selected-items",
236
- children: De()
237
- }), /* @__PURE__ */ _("div", {
237
+ children: Ae()
238
+ }), /* @__PURE__ */ g("div", {
238
239
  className: "gap-2 ml-2 flex shrink-0 items-center",
239
- children: /* @__PURE__ */ _(t, {
240
+ children: /* @__PURE__ */ g(t, {
240
241
  className: a("text-input-icon transition-transform duration-200", R && "rotate-180"),
241
242
  size: 20
242
243
  })
243
244
  })]
244
245
  })
245
246
  }),
246
- me && V.length > 0 && /* @__PURE__ */ _("button", {
247
+ ge && V.length > 0 && /* @__PURE__ */ g("button", {
247
248
  "aria-label": "Clear all selections",
248
249
  className: "right-10 text-input-icon hover:text-input-icon--hover rounded-sm absolute top-1/2 z-10 -translate-y-1/2 cursor-pointer focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50",
249
250
  "data-testid": "spectral-multiselect-clear-all-button",
@@ -252,70 +253,74 @@ var re = "h-4 w-4", y = (e) => ({
252
253
  e.stopPropagation(), X(), document.getElementById(F)?.focus();
253
254
  },
254
255
  type: "button",
255
- children: /* @__PURE__ */ _(n, { size: 12 })
256
+ children: /* @__PURE__ */ g(n, { size: 12 })
256
257
  }),
257
- /* @__PURE__ */ _(f, { children: /* @__PURE__ */ _(d, {
258
+ /* @__PURE__ */ g(ee, { children: /* @__PURE__ */ g(f, {
258
259
  align: "start",
259
260
  avoidCollisions: !0,
260
261
  className: ae(),
261
262
  collisionPadding: 10,
262
263
  "data-dropdown-width-mode": G,
263
- "data-dropdown-width-value": G === "custom" ? x : void 0,
264
+ "data-dropdown-width-value": G === "custom" ? S : void 0,
264
265
  "data-testid": "spectral-multiselect-dropdown",
265
266
  onOpenAutoFocus: (e) => {
266
- e.preventDefault(), k && U.current?.focus();
267
+ e.preventDefault(), O && U.current?.focus();
267
268
  },
268
269
  side: "bottom",
269
270
  sideOffset: 4,
270
- style: { width: xe },
271
- children: /* @__PURE__ */ v("div", {
271
+ ref: be,
272
+ style: {
273
+ width: we,
274
+ ...ye
275
+ },
276
+ children: /* @__PURE__ */ _("div", {
272
277
  className: "p-1",
273
- children: [k && /* @__PURE__ */ v("div", {
278
+ children: [O && /* @__PURE__ */ _("div", {
274
279
  className: "mb-2 relative",
275
- children: [/* @__PURE__ */ _(i, { className: a(re, "left-3 text-input-icon absolute top-1/2 -translate-y-1/2") }), /* @__PURE__ */ _("input", {
280
+ children: [/* @__PURE__ */ g(i, { className: a(v, "left-3 text-input-icon absolute top-1/2 -translate-y-1/2") }), /* @__PURE__ */ g("input", {
276
281
  "aria-label": "Search options",
277
282
  className: "pl-9 pr-3 py-2 text-sm rounded-md focus-visible:ring-black w-full border border-input-border bg-input-bg focus-visible:border-input-border--focus focus-visible:ring-1 focus-visible:outline-none",
278
283
  "data-testid": "spectral-multiselect-search-input",
279
- onChange: Ee,
280
- placeholder: fe,
284
+ onChange: ke,
285
+ placeholder: me,
281
286
  ref: U,
282
287
  type: "text",
283
288
  value: B
284
289
  })]
285
- }), /* @__PURE__ */ _("div", {
290
+ }), /* @__PURE__ */ g("div", {
286
291
  className: "max-h-64 overflow-y-auto",
287
292
  id: I,
288
293
  role: "listbox",
289
294
  "aria-multiselectable": "true",
290
- children: ye ? /* @__PURE__ */ v("div", {
295
+ children: Se ? /* @__PURE__ */ _("div", {
291
296
  "data-testid": "spectral-multiselect-loading",
292
297
  className: "gap-2 py-6 text-sm text-input-text-secondary flex items-center justify-center",
293
- children: [/* @__PURE__ */ _(r, {}), ue]
294
- }) : K.length === 0 ? /* @__PURE__ */ _("div", {
298
+ children: [/* @__PURE__ */ g(r, {}), de]
299
+ }) : K.length === 0 ? /* @__PURE__ */ g("div", {
295
300
  "data-testid": "spectral-multiselect-empty-message",
296
301
  className: "py-6 text-sm text-input-text-secondary text-center",
297
302
  children: se
298
- }) : /* @__PURE__ */ v(ne, { children: [
299
- A && /* @__PURE__ */ v("div", {
303
+ }) : /* @__PURE__ */ _(ie, { children: [
304
+ k && /* @__PURE__ */ _("div", {
300
305
  className: "mb-1",
301
- children: [/* @__PURE__ */ _("button", {
302
- className: a("gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary flex w-full items-center hover:bg-input-bg--hover focus:outline-none", Te && "bg-input-bg--hover"),
306
+ children: [/* @__PURE__ */ g("button", {
307
+ className: a("gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary flex w-full items-center hover:bg-input-bg--hover focus:outline-none", Oe && "bg-input-bg--hover"),
303
308
  "data-testid": "spectral-multiselect-select-all-button",
304
309
  onClick: Y,
305
310
  type: "button",
306
- children: Se ? y : pe
307
- }), /* @__PURE__ */ _("div", { className: "mx-3 my-1 h-px bg-input-border" })]
311
+ children: Te ? y : he
312
+ }), /* @__PURE__ */ g("div", { className: "mx-3 my-1 h-px bg-input-border" })]
308
313
  }),
309
- q.ungrouped.length > 0 && /* @__PURE__ */ _("div", {
314
+ q.ungrouped.length > 0 && /* @__PURE__ */ g("div", {
310
315
  className: "mb-1",
311
316
  children: q.ungrouped.map((e, t) => $(e, t))
312
317
  }),
313
- Object.entries(q.groups).map(([e, t]) => /* @__PURE__ */ v("div", {
318
+ Object.entries(q.groups).map(([e, t]) => /* @__PURE__ */ _("div", {
314
319
  className: "mb-1",
315
320
  "data-testid": "spectral-multiselect-group",
316
321
  children: [
317
- (q.ungrouped.length > 0 || Object.keys(q.groups).indexOf(e) > 0) && /* @__PURE__ */ _("div", { className: "mx-3 my-1 h-px bg-input-border" }),
318
- /* @__PURE__ */ _("div", {
322
+ (q.ungrouped.length > 0 || Object.keys(q.groups).indexOf(e) > 0) && /* @__PURE__ */ g("div", { className: "mx-3 my-1 h-px bg-input-border" }),
323
+ /* @__PURE__ */ g("div", {
319
324
  "data-testid": "spectral-multiselect-group-name",
320
325
  className: "px-3 py-1 text-xs font-semibold text-input-text-secondary tracking-wide uppercase",
321
326
  children: e
@@ -329,13 +334,13 @@ var re = "h-4 w-4", y = (e) => ({
329
334
  }) })
330
335
  ]
331
336
  })
332
- }), M === "error" && S && /* @__PURE__ */ _(o, {
337
+ }), j === "error" && C && /* @__PURE__ */ g(o, {
333
338
  dataTestId: "spectral-multiselect-error-message",
334
339
  id: L,
335
- message: S
340
+ message: C
336
341
  })]
337
342
  });
338
343
  };
339
- b.displayName = "MultiSelectBase";
344
+ x.displayName = "MultiSelectBase";
340
345
  //#endregion
341
- export { b as MultiSelectBase };
346
+ export { x as MultiSelectBase };