@spear-ai/spectral 1.3.60 → 1.3.62

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/Avatar.d.ts CHANGED
@@ -1,2 +1,14 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ type AvatarSize = 'small' | 'medium' | 'large';
3
+ export interface AvatarProps {
4
+ userFullName?: string;
5
+ imageSource?: string;
6
+ icon?: ReactElement;
7
+ fallback?: ReactNode;
8
+ size?: AvatarSize;
9
+ className?: string;
10
+ alt?: string;
11
+ }
12
+ export declare const Avatar: ({ userFullName, imageSource, icon, fallback, size, className, alt }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
1
13
  export {};
2
14
  //# sourceMappingURL=Avatar.d.ts.map
package/dist/Avatar.js CHANGED
@@ -1 +1,88 @@
1
-
1
+ "use client";
2
+ import "./styles/main.css";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { c as i } from "./twUtils-CRiPKpXj.js";
5
+ import { useState as x, useEffect as g, isValidElement as w, cloneElement as u } from "react";
6
+ const y = {
7
+ small: "h-8 w-8",
8
+ medium: "h-10 w-10",
9
+ large: "h-12 w-12"
10
+ }, v = {
11
+ small: "text-sm",
12
+ medium: "text-lg",
13
+ large: "text-2xl"
14
+ }, j = {
15
+ small: 24,
16
+ medium: 32,
17
+ large: 40
18
+ }, N = (l) => {
19
+ const t = l.trim();
20
+ if (!t) return "?";
21
+ const e = t.split(/\s+/).filter(Boolean);
22
+ return e.length === 0 ? "?" : e.length === 1 ? e[0].charAt(0).toUpperCase() : (e[0].charAt(0) + e[e.length - 1].charAt(0)).toUpperCase();
23
+ }, E = ({ userFullName: l, imageSource: t, icon: e, fallback: s, size: a = "medium", className: d, alt: c }) => {
24
+ const [f, o] = x("loading");
25
+ g(() => {
26
+ if (!t) return;
27
+ o("loading");
28
+ const r = new Image();
29
+ return r.src = t, r.onload = () => o("loaded"), r.onerror = () => o("error"), () => {
30
+ r.onload = null, r.onerror = null;
31
+ };
32
+ }, [t]);
33
+ const p = () => {
34
+ if (l)
35
+ return /* @__PURE__ */ n(
36
+ "span",
37
+ {
38
+ className: i(
39
+ "text-text-primary flex h-full w-full items-center justify-center font-bold tracking-tighter",
40
+ v[a]
41
+ ),
42
+ "aria-label": `${l} avatar`,
43
+ children: N(l)
44
+ }
45
+ );
46
+ if (e) {
47
+ const r = j[a];
48
+ return /* @__PURE__ */ n("span", { className: "flex h-full w-full items-center justify-center", children: w(e) ? (() => {
49
+ const m = {
50
+ className: i("shrink-0", e.props.className),
51
+ "aria-hidden": "true"
52
+ };
53
+ if (e.type.displayName?.includes("Icon") ?? !1) {
54
+ const h = {
55
+ ...m,
56
+ size: r
57
+ };
58
+ return u(e, h);
59
+ }
60
+ return u(e, m);
61
+ })() : e });
62
+ }
63
+ return t && f === "loaded" ? /* @__PURE__ */ n(
64
+ "img",
65
+ {
66
+ src: t,
67
+ "aria-label": c || "Avatar",
68
+ alt: c || "Avatar",
69
+ className: "absolute inset-0 h-full w-full rounded-full object-cover"
70
+ }
71
+ ) : t && f === "error" && s ? /* @__PURE__ */ n("span", { className: "flex h-full w-full items-center justify-center", children: s }) : s ? /* @__PURE__ */ n("span", { className: "text-text-primary flex h-full w-full items-center justify-center", children: s }) : /* @__PURE__ */ n("span", { className: "border-danger-300 text-danger-300 flex h-full w-full items-center justify-center rounded-full border-2 font-bold", children: "?" });
72
+ };
73
+ return /* @__PURE__ */ n(
74
+ "span",
75
+ {
76
+ className: i(
77
+ "bg-level-two relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full",
78
+ y[a],
79
+ d
80
+ ),
81
+ "data-slot": "avatar",
82
+ children: p()
83
+ }
84
+ );
85
+ };
86
+ export {
87
+ E as Avatar
88
+ };
@@ -2,7 +2,7 @@ import { AsChildProp } from '../../primitives/slot';
2
2
  import { ButtonHTMLAttributes, HTMLAttributes } from 'react';
3
3
  export type CheckedState = boolean | 'indeterminate';
4
4
  type BaseButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value'>;
5
- export type CheckboxProps = BaseButtonProps & AsChildProp & {
5
+ export type CheckboxBaseProps = BaseButtonProps & AsChildProp & {
6
6
  checked?: CheckedState;
7
7
  defaultChecked?: CheckedState;
8
8
  onCheckedChange?: (checked: CheckedState) => void;
@@ -11,7 +11,7 @@ export type CheckboxProps = BaseButtonProps & AsChildProp & {
11
11
  required?: boolean;
12
12
  form?: string;
13
13
  };
14
- export declare const Checkbox: import('react').ForwardRefExoticComponent<BaseButtonProps & AsChildProp & {
14
+ export declare const CheckboxBase: import('react').ForwardRefExoticComponent<BaseButtonProps & AsChildProp & {
15
15
  checked?: CheckedState;
16
16
  defaultChecked?: CheckedState;
17
17
  onCheckedChange?: (checked: CheckedState) => void;
@@ -1,18 +1,18 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as m, jsxs as M } from "react/jsx-runtime";
4
- import { useControllableState as O } from "../hooks/useControllableState.js";
3
+ import { jsx as m, jsxs as K } from "react/jsx-runtime";
4
+ import { useControllableState as M } from "../hooks/useControllableState.js";
5
5
  import { Slot as C } from "../primitives/slot.js";
6
6
  import { c as w } from "../twUtils-CRiPKpXj.js";
7
- import { createContext as T, forwardRef as E, useRef as V, useId as $, useEffect as y, useCallback as u, useContext as z } from "react";
8
- const R = T(null);
7
+ import { createContext as O, forwardRef as E, useRef as T, useId as V, useEffect as y, useCallback as u, useContext as $ } from "react";
8
+ const R = O(null);
9
9
  function I(r) {
10
10
  return r === "indeterminate" ? "indeterminate" : r ? "checked" : "unchecked";
11
11
  }
12
- function A(r) {
12
+ function z(r) {
13
13
  return r === "indeterminate" ? !0 : !r;
14
14
  }
15
- const B = E(
15
+ const A = E(
16
16
  ({
17
17
  asChild: r,
18
18
  className: d,
@@ -31,7 +31,7 @@ const B = E(
31
31
  // oxlint-disable-line no-unused-vars
32
32
  ...k
33
33
  }, S) => {
34
- const o = V(null), P = $(), D = j ?? `chk-${P}`, [t, a] = O({
34
+ const o = T(null), P = V(), B = j ?? `chk-${P}`, [t, a] = M({
35
35
  value: l,
36
36
  defaultValue: i,
37
37
  onChange: f
@@ -54,24 +54,24 @@ const B = E(
54
54
  e.dispatchEvent(c);
55
55
  }, [t]), s = u(() => {
56
56
  if (n) return;
57
- const e = A(t);
57
+ const e = z(t);
58
58
  a(e), queueMicrotask(() => g());
59
- }, [n, g, a, t]), L = u(
59
+ }, [n, g, a, t]), D = u(
60
60
  (e) => {
61
61
  v?.(e), !e.defaultPrevented && s();
62
62
  },
63
63
  [s, v]
64
- ), q = u(
64
+ ), L = u(
65
65
  (e) => {
66
66
  x?.(e), !e.defaultPrevented && e.key === " " && (e.preventDefault(), s());
67
67
  },
68
68
  [s, x]
69
- ), F = r ? C : "button", K = S;
70
- return /* @__PURE__ */ m(R.Provider, { value: { state: t, disabled: n }, children: /* @__PURE__ */ M(
71
- F,
69
+ ), q = r ? C : "button", F = S;
70
+ return /* @__PURE__ */ m(R.Provider, { value: { state: t, disabled: n }, children: /* @__PURE__ */ K(
71
+ q,
72
72
  {
73
- id: D,
74
- ref: K,
73
+ id: B,
74
+ ref: F,
75
75
  type: "button",
76
76
  role: "checkbox",
77
77
  "aria-checked": t === "indeterminate" ? "mixed" : t,
@@ -86,8 +86,8 @@ const B = E(
86
86
  "data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
87
87
  d
88
88
  ),
89
- onClick: L,
90
- onKeyDown: q,
89
+ onClick: D,
90
+ onKeyDown: L,
91
91
  disabled: n,
92
92
  ...k,
93
93
  children: [
@@ -120,10 +120,10 @@ const B = E(
120
120
  ) });
121
121
  }
122
122
  );
123
- B.displayName = "Checkbox";
123
+ A.displayName = "CheckboxBase";
124
124
  const G = E(
125
125
  ({ asChild: r, className: d, forceMount: l, ...i }, f) => {
126
- const n = z(R);
126
+ const n = $(R);
127
127
  return !n || !(n.state === !0 || n.state === "indeterminate") && !l ? null : /* @__PURE__ */ m(
128
128
  r ? C : "span",
129
129
  {
@@ -138,6 +138,6 @@ const G = E(
138
138
  );
139
139
  G.displayName = "CheckboxIndicator";
140
140
  export {
141
- B as Checkbox,
141
+ A as CheckboxBase,
142
142
  G as CheckboxIndicator
143
143
  };
@@ -0,0 +1,14 @@
1
+ import { CheckboxBase } from './CheckboxBase';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<typeof CheckboxBase>, 'onCheckedChange'> {
4
+ checked?: boolean | 'indeterminate';
5
+ disabled?: boolean;
6
+ id: string;
7
+ labelText: string;
8
+ name?: string;
9
+ onCheckedChange: (value: boolean | 'indeterminate') => void;
10
+ required?: boolean;
11
+ value?: string;
12
+ }
13
+ export declare const Checkbox: import('react').ForwardRefExoticComponent<CheckboxProps & import('react').RefAttributes<HTMLButtonElement>>;
14
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1,99 @@
1
+ "use client";
2
+ import "./styles/main.css";
3
+ import { jsxs as d, jsx as o } from "react/jsx-runtime";
4
+ import { CheckboxBase as l, CheckboxIndicator as b } from "./Checkbox/CheckboxBase.js";
5
+ import "./Icons/AnnotationsIcon.js";
6
+ import "./Icons/CalendarIcon.js";
7
+ import "./Icons/CheckCircleIcon.js";
8
+ import "./Icons/CheckSquareIcon.js";
9
+ import { CheckmarkIcon as h } from "./Icons/CheckmarkIcon.js";
10
+ import "./Icons/ChevronDownIcon.js";
11
+ import "./Icons/ChevronUpIcon.js";
12
+ import "./Icons/ClockIcon.js";
13
+ import "./Icons/CloseCircleIcon.js";
14
+ import "./Icons/CloseIcon.js";
15
+ import "./Icons/DashboardIcon.js";
16
+ import "./Icons/DeleteIcon.js";
17
+ import "./Icons/DurationIcon.js";
18
+ import "./Icons/EmailIcon.js";
19
+ import "./Icons/EraserIcon.js";
20
+ import "./Icons/ErrorIcon.js";
21
+ import "./Icons/EyeClosedIcon.js";
22
+ import "./Icons/EyeClosedIcon2.js";
23
+ import "./Icons/EyeOpenIcon.js";
24
+ import "./Icons/GoToFirstIcon.js";
25
+ import "./Icons/GoToLastIcon.js";
26
+ import "./Icons/HarmonicCursorsIcon.js";
27
+ import "./Icons/InfoIcon.js";
28
+ import "./Icons/LabelIcon.js";
29
+ import "./Icons/LassoIcon.js";
30
+ import "./Icons/LineToolIcon.js";
31
+ import "./Icons/LiveViewIcon.js";
32
+ import "./Icons/LoaderIcon.js";
33
+ import "./Icons/LocationIcon.js";
34
+ import "./Icons/LogoutIcon.js";
35
+ import "./Icons/MetadataIcon.js";
36
+ import { MinusIcon as n } from "./Icons/MinusIcon.js";
37
+ import "./Icons/OntologyIcon.js";
38
+ import "./Icons/PanelIconClose.js";
39
+ import "./Icons/PanelIconOpen.js";
40
+ import "./Icons/PlayIcon.js";
41
+ import "./Icons/PlusIcon.js";
42
+ import "./Icons/ResetIcon.js";
43
+ import "./Icons/ScissorsIcon.js";
44
+ import "./Icons/SettingsIcon.js";
45
+ import "./Icons/TrashIcon.js";
46
+ import "./Icons/UndoIcon.js";
47
+ import "./Icons/UserIcon.js";
48
+ import "./Icons/WarningIcon.js";
49
+ import "./Icons/ZoomAllIcon.js";
50
+ import "./Icons/ZoomXIcon.js";
51
+ import "./Icons/ZoomYIcon.js";
52
+ import { c as i } from "./twUtils-CRiPKpXj.js";
53
+ import { forwardRef as x } from "react";
54
+ const k = x(
55
+ ({ className: e, id: r, labelText: m, onCheckedChange: t, checked: c, required: p, ...a }, s) => /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
56
+ /* @__PURE__ */ o(
57
+ l,
58
+ {
59
+ className: i(
60
+ [
61
+ "checkbox peer border-checkbox-border h-5 w-5 shrink-0 rounded-sm border hover:opacity-80",
62
+ "focus-visible:outline-checkbox-border--focus focus:outline-hidden focus-visible:outline-1 focus-visible:outline-offset-2 disabled:cursor-not-allowed",
63
+ "data-[state=checked]:border-checkbox-border--checked disabled:opacity-50"
64
+ ].join(" "),
65
+ e
66
+ ),
67
+ "data-testid": "checkbox",
68
+ id: r,
69
+ id: r,
70
+ "aria-labelledby": `${r}-label`,
71
+ "aria-required": p,
72
+ onCheckedChange: t,
73
+ onCheckedChange: t,
74
+ ref: s,
75
+ ...a,
76
+ children: /* @__PURE__ */ o(
77
+ b,
78
+ {
79
+ className: i("checkbox-indicator text-checkbox-indicator--checked flex items-center justify-center"),
80
+ children: c === "indeterminate" ? /* @__PURE__ */ o(n, { className: "checkbox-indeterminate", size: 16, strokeWidth: 4 }) : /* @__PURE__ */ o(h, { className: "checkbox-check", size: 16, strokeWidth: 4 })
81
+ }
82
+ )
83
+ }
84
+ ),
85
+ /* @__PURE__ */ o(
86
+ "label",
87
+ {
88
+ htmlFor: r,
89
+ className: "text-md text-text-primary peer-disabled:text-neutral-400",
90
+ "data-testid": "checkbox-label",
91
+ children: m
92
+ }
93
+ )
94
+ ] })
95
+ );
96
+ k.displayName = "Checkbox";
97
+ export {
98
+ k as Checkbox
99
+ };
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsxs as a, jsx as o } from "react/jsx-runtime";
4
- import m from "./IconBase.js";
5
- import { forwardRef as i } from "react";
6
- const h = ({ className: r, ariaHidden: e, title: n = "Checkmark", description: t, size: c = 24, ...k }, s) => /* @__PURE__ */ a(
7
- m,
3
+ import { jsxs as s, jsx as o } from "react/jsx-runtime";
4
+ import i from "./IconBase.js";
5
+ import { forwardRef as h } from "react";
6
+ const p = ({ className: r, ariaHidden: e, title: n = "Checkmark", description: t, size: c = 24, strokeWidth: k = 2, ...a }, m) => /* @__PURE__ */ s(
7
+ i,
8
8
  {
9
9
  size: c,
10
10
  className: r,
11
11
  title: n,
12
12
  description: t,
13
13
  ariaHidden: e,
14
- ref: s,
15
- ...k,
14
+ ref: m,
15
+ ...a,
16
16
  stroke: "currentColor",
17
- strokeWidth: "2",
17
+ strokeWidth: k,
18
18
  strokeLinecap: "round",
19
19
  strokeLinejoin: "round",
20
20
  children: [
@@ -22,7 +22,7 @@ const h = ({ className: r, ariaHidden: e, title: n = "Checkmark", description: t
22
22
  /* @__PURE__ */ o("path", { d: "M5 12l5 5l10 -10" })
23
23
  ]
24
24
  }
25
- ), d = i(h);
25
+ ), d = h(p);
26
26
  d.displayName = "CheckmarkIcon";
27
27
  export {
28
28
  d as CheckmarkIcon
@@ -1,26 +1,26 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
3
  import { jsx as o } from "react/jsx-runtime";
4
- import u from "./IconBase.js";
5
- import { forwardRef as d } from "react";
6
- const m = ({ className: r, ariaHidden: n, title: t = "Minus", description: e, size: i = 24, ...s }, c) => /* @__PURE__ */ o(
7
- u,
4
+ import m from "./IconBase.js";
5
+ import { forwardRef as p } from "react";
6
+ const a = ({ className: r, ariaHidden: n, title: e = "Minus", description: i, strokeWidth: s = 2, size: t = 24, ...c }, u) => /* @__PURE__ */ o(
7
+ m,
8
8
  {
9
- size: i,
9
+ size: t,
10
10
  className: r,
11
- title: t,
12
- description: e,
11
+ title: e,
12
+ description: i,
13
13
  ariaHidden: n,
14
- ref: c,
14
+ ref: u,
15
15
  stroke: "currentColor",
16
- strokeWidth: "2",
16
+ strokeWidth: s,
17
17
  strokeLinecap: "round",
18
18
  strokeLinejoin: "round",
19
- ...s,
19
+ ...c,
20
20
  children: /* @__PURE__ */ o("path", { d: "M5 12l14 0" })
21
21
  }
22
- ), p = d(m);
23
- p.displayName = "MinusIcon";
22
+ ), d = p(a);
23
+ d.displayName = "MinusIcon";
24
24
  export {
25
- p as MinusIcon
25
+ d as MinusIcon
26
26
  };
@@ -1,9 +1,12 @@
1
1
  import { OTPInputProps } from 'input-otp';
2
2
  type InputOTPRootProps = Omit<OTPInputProps, 'textAlign' | 'pushPasswordManagerStrategy' | 'pasteTransformer' | 'noScriptCSSFallback' | 'placeholder' | 'containerClassName' | 'render'> & {
3
- onComplete?: (...args: any[]) => void;
3
+ onComplete?: (...args: unknown[]) => void;
4
4
  inputMode?: 'numeric' | 'text' | 'decimal' | 'tel' | 'search' | 'email' | 'url';
5
5
  className?: string;
6
6
  separator?: boolean;
7
+ variant?: 'outlined' | 'filled';
8
+ groupSize?: number;
9
+ separatorPositions?: number[];
7
10
  };
8
11
  export type InputOTPProps = InputOTPRootProps & ({
9
12
  value: number | string;