@spear-ai/spectral 1.4.5 → 1.4.7

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.
@@ -4,6 +4,8 @@ import { jsxs as o, jsx as r, Fragment as de } from "react/jsx-runtime";
4
4
  import "../Icons/AnalyzeIcon.js";
5
5
  import "../Icons/AnnotationsIcon.js";
6
6
  import "../Icons/ApprovedIcon.js";
7
+ import "../Icons/ArrowDownIcon.js";
8
+ import "../Icons/ArrowUpIcon.js";
7
9
  import "../Icons/CalendarIcon.js";
8
10
  import "../Icons/CheckCircleIcon.js";
9
11
  import "../Icons/CheckSquareIcon.js";
@@ -61,57 +63,51 @@ import "../Icons/ZoomYIcon.js";
61
63
  import { ErrorMessage as me } from "../utils/formFieldUtils.js";
62
64
  import { cn as f } from "../utils/twUtils.js";
63
65
  import { forwardRef as be, useId as fe, useState as L, useRef as _, useMemo as T, useCallback as b, useEffect as ge } from "react";
64
- import { c as he } from "../createLucideIcon-B_8CJpcQ.js";
65
- /**
66
- * @license lucide-react v0.546.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */
66
+ import { c as he } from "../createLucideIcon-D4r5Phnh.js";
71
67
  const xe = [
72
68
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
73
69
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
74
- ], ye = he("search", xe), ve = "h-4 w-4", we = (i) => ({
70
+ ], ye = he("search", xe), ve = "h-4 w-4", we = (s) => ({
75
71
  error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
76
72
  loading: "cursor-wait border-input-border--disabled",
77
73
  disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
78
74
  default: ""
79
- })[i], Ne = (i, l, d) => f(
75
+ })[s], Ne = (s, l, d) => f(
80
76
  "flex h-12 w-full items-center justify-between rounded-lg border border-input-border bg-input-bg px-4 py-3 text-sm",
81
77
  "hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
82
78
  "focus:ring-2 focus:ring-black focus:ring-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2",
83
79
  "disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
84
80
  "transition duration-200 text-input-text",
85
81
  l && "border-input-border--focus ring-2 ring-black ring-offset-2",
86
- we(i),
82
+ we(s),
87
83
  d
88
- ), ke = (i) => f(
84
+ ), ke = (s) => f(
89
85
  "absolute top-full left-0 right-0 z-50 mt-1 max-h-80 overflow-hidden rounded-lg border border-input-border bg-input-bg shadow-lg",
90
86
  "transition-all duration-200 origin-top",
91
- i ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
92
- ), Ce = (i) => {
87
+ s ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
88
+ ), Ce = (s) => {
93
89
  const l = _(null);
94
90
  return ge(() => {
95
91
  const d = (n) => {
96
- l.current && !l.current.contains(n.target) && i();
92
+ l.current && !l.current.contains(n.target) && s();
97
93
  };
98
94
  return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
99
- }, [i]), l;
100
- }, Ie = (i, l, d) => {
95
+ }, [s]), l;
96
+ }, Ie = (s, l, d) => {
101
97
  const [n, g] = L(-1), I = b(
102
98
  (u) => {
103
99
  const v = {
104
100
  ArrowDown: () => {
105
- u.preventDefault(), g((h) => Math.min(h + 1, i.length - 1));
101
+ u.preventDefault(), g((h) => Math.min(h + 1, s.length - 1));
106
102
  },
107
103
  ArrowUp: () => {
108
104
  u.preventDefault(), g((h) => Math.max(h - 1, -1));
109
105
  },
110
106
  Enter: () => {
111
- u.preventDefault(), n >= 0 && i[n] && l(i[n].value);
107
+ u.preventDefault(), n >= 0 && s[n] && l(s[n].value);
112
108
  },
113
109
  " ": () => {
114
- u.preventDefault(), n >= 0 && i[n] && l(i[n].value);
110
+ u.preventDefault(), n >= 0 && s[n] && l(s[n].value);
115
111
  },
116
112
  Escape: () => {
117
113
  u.preventDefault(), d();
@@ -119,12 +115,12 @@ const xe = [
119
115
  }[u.key];
120
116
  v && v();
121
117
  },
122
- [i, n, l, d]
118
+ [s, n, l, d]
123
119
  );
124
120
  return { focusedIndex: n, setFocusedIndex: g, handleKeyDown: I };
125
121
  }, Se = be(
126
122
  ({
127
- className: i,
123
+ className: s,
128
124
  clearAllLabel: l = "Clear all",
129
125
  closeOnSelect: d = !1,
130
126
  emptyMessage: n = "No options found",
@@ -150,13 +146,13 @@ const xe = [
150
146
  ...z
151
147
  }, J) => {
152
148
  const Q = fe(), S = I || `${h}-${Q}`, K = `${S}-error`, [y, k] = L(!1), [D, W] = L(""), X = Ce(() => k(!1)), A = _(null), O = z.disabled || x === "disabled", Y = x === "loading", ee = x === "error", w = T(() => {
153
- let e = m.filter((s) => s.label.toLowerCase().includes(D.toLowerCase()));
154
- return R && (e = [...e].sort((s, t) => s.label.localeCompare(t.label))), e;
149
+ let e = m.filter((i) => i.label.toLowerCase().includes(D.toLowerCase()));
150
+ return R && (e = [...e].sort((i, t) => i.label.localeCompare(t.label))), e;
155
151
  }, [m, D, R]), N = T(() => {
156
- const e = {}, s = [];
152
+ const e = {}, i = [];
157
153
  return w.forEach((t) => {
158
- t.group ? (e[t.group] || (e[t.group] = []), e[t.group].push(t)) : s.push(t);
159
- }), { groups: e, ungrouped: s, hasGroups: Object.keys(e).length > 0 };
154
+ t.group ? (e[t.group] || (e[t.group] = []), e[t.group].push(t)) : i.push(t);
155
+ }), { groups: e, ungrouped: i, hasGroups: Object.keys(e).length > 0 };
160
156
  }, [w]), C = b(
161
157
  (e) => {
162
158
  if (m.find((c) => c.value === e)?.disabled) return;
@@ -164,24 +160,24 @@ const xe = [
164
160
  p(t), d && k(!1);
165
161
  },
166
162
  [m, a, p, d]
167
- ), { focusedIndex: te, handleKeyDown: re } = Ie(w, C, () => k(!1)), se = b(() => {
163
+ ), { focusedIndex: te, handleKeyDown: re } = Ie(w, C, () => k(!1)), ie = b(() => {
168
164
  O || k((e) => (e || setTimeout(() => A.current?.focus(), 0), !e));
169
- }, [O]), ie = b(() => {
170
- const e = m.filter((t) => !t.disabled).map((t) => t.value), s = e.every((t) => a.includes(t));
171
- p(s ? [] : e);
165
+ }, [O]), se = b(() => {
166
+ const e = m.filter((t) => !t.disabled).map((t) => t.value), i = e.every((t) => a.includes(t));
167
+ p(i ? [] : e);
172
168
  }, [m, a, p]), j = b(() => {
173
169
  p([]);
174
170
  }, [p]), oe = b((e) => {
175
171
  W(e.target.value);
176
172
  }, []), le = b(
177
- (e, s) => {
178
- s.stopPropagation(), C(e);
173
+ (e, i) => {
174
+ i.stopPropagation(), C(e);
179
175
  },
180
176
  [C]
181
177
  ), ne = () => {
182
178
  if (a.length === 0)
183
179
  return /* @__PURE__ */ r("span", { className: "text-input-text-placeholder", children: $ });
184
- const e = a.slice(0, v), s = a.length - v;
180
+ const e = a.slice(0, v), i = a.length - v;
185
181
  return /* @__PURE__ */ o("div", { className: "flex items-center gap-1 flex-wrap", children: [
186
182
  e.map((t) => {
187
183
  const c = m.find((E) => E.value === t);
@@ -190,13 +186,13 @@ const xe = [
190
186
  /* @__PURE__ */ r("button", { "aria-label": `Remove ${c.label}`, className: "hover:text-danger focus:outline-none", "data-testid": "spectral-multiselect-remove-item-button", onClick: (E) => le(t, E), type: "button", children: /* @__PURE__ */ r(P, { size: 12 }) })
191
187
  ] }, t) : null;
192
188
  }),
193
- s > 0 && /* @__PURE__ */ o("span", { className: "text-input-text-secondary text-xs", children: [
189
+ i > 0 && /* @__PURE__ */ o("span", { className: "text-input-text-secondary text-xs", children: [
194
190
  "+",
195
- s,
191
+ i,
196
192
  " more"
197
193
  ] })
198
194
  ] });
199
- }, F = (e, s) => {
195
+ }, F = (e, i) => {
200
196
  const t = a.includes(e.value);
201
197
  return /* @__PURE__ */ o(
202
198
  "button",
@@ -204,7 +200,7 @@ const xe = [
204
200
  className: f(
205
201
  "w-full flex items-center gap-3 px-3 py-2 text-sm text-left hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none",
206
202
  "disabled:opacity-50 disabled:cursor-not-allowed",
207
- s === te && "bg-input-bg--hover",
203
+ i === te && "bg-input-bg--hover",
208
204
  t && "text-input-text font-medium"
209
205
  ),
210
206
  disabled: e.disabled,
@@ -231,13 +227,13 @@ const xe = [
231
227
  "aria-describedby": f(ee && K, q),
232
228
  "aria-expanded": y,
233
229
  "aria-label": Z || u,
234
- className: Ne(x, y, i),
230
+ className: Ne(x, y, s),
235
231
  "data-state": x,
236
232
  "data-testid": "spectral-multiselect-trigger",
237
233
  disabled: O,
238
234
  id: S,
239
235
  name: h,
240
- onClick: se,
236
+ onClick: ie,
241
237
  ref: J,
242
238
  role: "combobox",
243
239
  style: ae(),
@@ -294,18 +290,18 @@ const xe = [
294
290
  {
295
291
  className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none",
296
292
  "data-testid": "spectral-multiselect-select-all-button",
297
- onClick: ie,
293
+ onClick: se,
298
294
  type: "button",
299
295
  children: H
300
296
  }
301
297
  ),
302
298
  /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" })
303
299
  ] }),
304
- N.ungrouped.length > 0 && /* @__PURE__ */ r("div", { className: "mb-1", children: N.ungrouped.map((e, s) => F(e, s)) }),
305
- Object.entries(N.groups).map(([e, s]) => /* @__PURE__ */ o("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
300
+ N.ungrouped.length > 0 && /* @__PURE__ */ r("div", { className: "mb-1", children: N.ungrouped.map((e, i) => F(e, i)) }),
301
+ Object.entries(N.groups).map(([e, i]) => /* @__PURE__ */ o("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
306
302
  (N.ungrouped.length > 0 || Object.keys(N.groups).indexOf(e) > 0) && /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
307
303
  /* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-group-name", className: "px-3 py-1 text-xs font-semibold text-input-text-secondary uppercase tracking-wide", children: e }),
308
- s.map((t, c) => F(t, w.indexOf(t)))
304
+ i.map((t, c) => F(t, w.indexOf(t)))
309
305
  ] }, e)),
310
306
  V && a.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1", children: [
311
307
  /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
@@ -432,7 +432,7 @@ const B = he(
432
432
  "data-testid": "spectral-radio-group-item",
433
433
  className: F(
434
434
  "relative aspect-square h-4.5 w-4.5 rounded-full border-2 border-border-subtle bg-radio-bg ring-black transition-colors cursor-pointer",
435
- "hover:border-radio-border--hover focus-visible:ring-1 focus-visible:ring-offset-2",
435
+ "hover:border-radio-border--hover focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-accent",
436
436
  "[&[data-state=checked]]:border-radio-border--selected [&[data-state=checked]]:bg-radio-bg",
437
437
  o && A,
438
438
  r
package/dist/Select.js CHANGED
@@ -4,6 +4,8 @@ import { jsxs as r, jsx as t, Fragment as S } from "react/jsx-runtime";
4
4
  import "./Icons/AnalyzeIcon.js";
5
5
  import "./Icons/AnnotationsIcon.js";
6
6
  import "./Icons/ApprovedIcon.js";
7
+ import "./Icons/ArrowDownIcon.js";
8
+ import "./Icons/ArrowUpIcon.js";
7
9
  import "./Icons/CalendarIcon.js";
8
10
  import "./Icons/CheckCircleIcon.js";
9
11
  import "./Icons/CheckSquareIcon.js";
package/dist/Textarea.js CHANGED
@@ -5,6 +5,8 @@ import { useTextarea as z } from "./Textarea/TextareaUtils.js";
5
5
  import "./Icons/AnalyzeIcon.js";
6
6
  import "./Icons/AnnotationsIcon.js";
7
7
  import "./Icons/ApprovedIcon.js";
8
+ import "./Icons/ArrowDownIcon.js";
9
+ import "./Icons/ArrowUpIcon.js";
8
10
  import "./Icons/CalendarIcon.js";
9
11
  import "./Icons/CheckCircleIcon.js";
10
12
  import "./Icons/CheckSquareIcon.js";
@@ -13,5 +13,5 @@ export declare const ToggleBase: import('react').ForwardRefExoticComponent<Omit<
13
13
  onPressedChange?: (pressed: boolean) => void;
14
14
  disabled?: boolean;
15
15
  asChild?: boolean;
16
- } & import('react').RefAttributes<HTMLButtonElement>>;
16
+ } & import('react').RefAttributes<HTMLButtonElement | HTMLDivElement>>;
17
17
  //# sourceMappingURL=ToggleBase.d.ts.map
@@ -1,28 +1,46 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as h } from "react/jsx-runtime";
3
+ import { jsx as f } from "react/jsx-runtime";
4
4
  import { useControllableState as k } from "../hooks/useControllableState.js";
5
- import { Slot as y } from "../primitives/slot.js";
6
- import { forwardRef as P, useCallback as f } from "react";
7
- const B = P(function({ pressed: u, defaultPressed: d = !1, onPressedChange: p, disabled: t, className: i, onKeyDown: n, onClick: a, type: m = "button", asChild: s = !1, ...c }, g) {
8
- const [o, l] = k({
9
- value: u,
10
- defaultValue: d,
11
- onChange: p
12
- }), r = f(() => {
13
- t || l(!o);
14
- }, [t, o, l]), v = f(
5
+ import { Slot as C } from "../primitives/slot.js";
6
+ import { forwardRef as T, useCallback as s } from "react";
7
+ const B = T(function({ pressed: c, defaultPressed: m = !1, onPressedChange: g, disabled: t, className: v, onKeyDown: a, onClick: n, type: h = "button", asChild: b = !1, children: l, ...u }, d) {
8
+ const [r, i] = k({
9
+ defaultValue: m,
10
+ onChange: g,
11
+ value: c
12
+ }), o = s(() => {
13
+ t || i(!r);
14
+ }, [t, r, i]), x = s(
15
15
  (e) => {
16
- n && n(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), r());
16
+ a && a(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), o());
17
17
  },
18
- [r, n]
19
- ), C = f(
18
+ [o, a]
19
+ ), P = s(
20
20
  (e) => {
21
- a && a(e), !e.defaultPrevented && r();
21
+ n && n(e), !e.defaultPrevented && o();
22
22
  },
23
- [r, a]
24
- );
25
- return /* @__PURE__ */ h(s ? y : "button", { ...c, ref: g, type: s ? void 0 : m, "aria-pressed": o, "data-state": o ? "on" : "off", "data-disabled": t ? "" : void 0, disabled: t, onKeyDown: v, onClick: C, className: i });
23
+ [o, n]
24
+ ), p = {
25
+ "aria-disabled": t || void 0,
26
+ "aria-pressed": r,
27
+ "data-state": r ? "on" : "off",
28
+ "data-disabled": t || void 0,
29
+ className: v,
30
+ onClick: P,
31
+ onKeyDown: x
32
+ };
33
+ return b ? /* @__PURE__ */ f(
34
+ "div",
35
+ {
36
+ ref: d,
37
+ role: "button",
38
+ tabIndex: t ? -1 : 0,
39
+ ...u,
40
+ ...p,
41
+ children: /* @__PURE__ */ f(C, { children: l })
42
+ }
43
+ ) : /* @__PURE__ */ f("button", { ref: d, tabIndex: t ? -1 : 0, type: h, ...u, ...p, children: l });
26
44
  });
27
45
  export {
28
46
  B as ToggleBase
package/dist/Toggle.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { jsx as g } from "react/jsx-runtime";
4
- import { ToggleBase as n } from "./Toggle/ToggleBase.js";
5
- import { cn as s } from "./utils/twUtils.js";
6
- import { c as d } from "./index-D29mdTf5.js";
7
- import { forwardRef as l } from "react";
8
- const v = d(
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { ToggleBase as s } from "./Toggle/ToggleBase.js";
5
+ import { cn as d } from "./utils/twUtils.js";
6
+ import { c as l } from "./index-D29mdTf5.js";
7
+ import { forwardRef as v } from "react";
8
+ const b = l(
9
9
  `
10
- bg-toggle-bg inline-flex items-center justify-center gap-2 border rounded-md text-sm shadow-sm font-medium w-fit disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed
10
+ bg-toggle-bg inline-flex items-center justify-center gap-2 border rounded-md text-sm shadow-sm font-medium w-fit data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed
11
11
  hover:cursor-pointer data-[state=on]:text-toggle-text--active text-toggle-text hover:bg-toggle-bg--hover hover:border-toggle-border--hover data-[state=on]:bg-toggle-bg--active
12
12
  data-[state=on]:border-toggle-border--active hover:text-toggle-text--hover data-[state=on]:bg-toggle-bg--active data-[state=on]:text-toggle-text--active data-[state=on]:border-toggle-border--active
13
13
  transition-[colors] [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus:outline-none outline-none
@@ -35,8 +35,8 @@ const v = d(
35
35
  layout: "default"
36
36
  }
37
37
  }
38
- ), m = l(({ className: e, variant: t, size: o, layout: r, ...a }, i) => /* @__PURE__ */ g(n, { ref: i, "data-slot": "toggle", "data-testid": "spectral-toggle", className: s(v({ variant: t, size: o, layout: r }), e), ...a }));
38
+ ), p = v(({ className: e, variant: t, size: o, layout: r, disabled: a, ...i }, g) => /* @__PURE__ */ n(s, { ref: g, disabled: a, "data-slot": "toggle", "data-testid": "spectral-toggle", className: d(b({ variant: t, size: o, layout: r }), e), ...i }));
39
39
  export {
40
- m as Toggle,
41
- v as toggleVariants
40
+ p as Toggle,
41
+ b as toggleVariants
42
42
  };
package/dist/Tooltip.d.ts CHANGED
@@ -1,9 +1,14 @@
1
+ import { VariantProps } from 'class-variance-authority';
1
2
  import { ComponentProps } from 'react';
2
3
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
4
  export declare const TooltipProvider: ({ delayDuration, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>) => import("react/jsx-runtime").JSX.Element;
4
5
  export declare const Tooltip: ({ ...props }: ComponentProps<typeof TooltipPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
5
- export declare const TooltipTrigger: ({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) => import("react/jsx-runtime").JSX.Element;
6
- export declare const TooltipContent: ({ children, className, showArrow, sideOffset, ...props }: ComponentProps<typeof TooltipPrimitive.Content> & {
6
+ export declare const TooltipTrigger: ({ asChild, children, ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) => import("react/jsx-runtime").JSX.Element;
7
+ declare const tooltipVariants: (props?: ({
8
+ variant?: "default" | "outline" | null | undefined;
9
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
10
+ export declare const TooltipContent: ({ children, className, showArrow, sideOffset, variant, side, ...props }: ComponentProps<typeof TooltipPrimitive.Content> & VariantProps<typeof tooltipVariants> & {
7
11
  showArrow?: boolean;
8
12
  }) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
9
14
  //# sourceMappingURL=Tooltip.d.ts.map