@spear-ai/spectral 1.4.18 → 1.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
1
  import "../styles/main.css";
2
- import { jsx as s } from "react/jsx-runtime";
2
+ import { jsx as n } from "react/jsx-runtime";
3
3
  import { Slot as a } from "../primitives/slot.js";
4
4
  import { cn as r } from "../utils/twUtils.js";
5
- import { c } from "../index-D29mdTf5.js";
5
+ import { c as l } from "../index-D29mdTf5.js";
6
6
  import "react";
7
- const l = c(
7
+ const c = l(
8
8
  `inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius,0.375rem)] text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none
9
9
  [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-accent focus-visible:outline-offset-2 focus-visible:outline-2 focus-visible:outline-accent
10
- aria-invalid:ring-destructive/20 aria-invalid:border-destructive bg-level-one text-text-primary hover:bg-level-two cursor-pointer active:text-accent`,
10
+ aria-invalid:ring-destructive/20 aria-invalid:border-destructive bg-level-one text-text-primary hover:bg-level-two cursor-pointer active:text-text-inverted active:bg-accent`,
11
11
  {
12
12
  variants: {
13
13
  variant: {
14
14
  default: "",
15
- outline: "border border-level-three active:text-accent active:border-accent"
15
+ outline: "border border-level-three"
16
16
  },
17
17
  size: {
18
18
  md: "h-9 px-4 py-2 has-[>svg]:px-3",
@@ -33,10 +33,10 @@ const l = c(
33
33
  variant: t,
34
34
  size: e,
35
35
  asChild: o = !1,
36
- ...n
37
- }) => /* @__PURE__ */ s(o ? a : "button", { "data-slot": "button-group-item", "data-variant": t, "data-size": e, className: r(l({ variant: t, size: e, className: i })), ...n });
36
+ ...s
37
+ }) => /* @__PURE__ */ n(o ? a : "button", { "data-slot": "button-group-item", "data-variant": t, "data-size": e, className: r(c({ variant: t, size: e, className: i })), ...s });
38
38
  u.displayName = "ButtonGroupButton";
39
39
  export {
40
40
  u as ButtonGroupButton,
41
- l as buttonVariants
41
+ c as buttonVariants
42
42
  };
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
3
3
  import { ComponentProps } from 'react';
4
4
  export declare const InputGroup: ({ className, ...props }: ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
5
5
  export declare const inputGroupAddonVariants: (props?: ({
6
- align?: "block-end" | "block-start" | "inline-end" | "inline-start" | null | undefined;
6
+ align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
8
  export declare const InputGroupAddon: ({ className, align, ...props }: ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) => import("react/jsx-runtime").JSX.Element;
9
9
  export declare const inputGroupButtonVariants: (props?: ({
package/dist/Tabs.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import "./styles/main.css";
2
- import { jsx as a, jsxs as x } from "react/jsx-runtime";
2
+ import { jsx as a, jsxs as m } from "react/jsx-runtime";
3
3
  import { TabsBase as N, TabsList as T, TabsTrigger as z, TabsContent as k } from "./Tabs/TabsBase.js";
4
4
  import { validateTabValues as j, getTabKeys as C } from "./Tabs/tabsUtils.js";
5
5
  import { cn as r } from "./utils/twUtils.js";
6
6
  import "react";
7
- const V = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ x("div", { className: "flex flex-col relative w-full", role: "status", children: [
7
+ const V = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ m("div", { className: "flex flex-col relative w-full", role: "status", children: [
8
8
  /* @__PURE__ */ a("div", { className: r("inline-flex items-center justify-start w-full", s === "horizontal" && "border-b border-neutral-600", s === "vertical" && "flex-col items-stretch border-r border-neutral-600"), children: Array.from({ length: Math.min(d, 5) }, (i, t) => /* @__PURE__ */ a("div", { className: r("animate-pulse bg-neutral-600 rounded", s === "horizontal" ? "h-6 w-16 mx-2 my-2" : "h-6 w-full mx-2 my-1"), "aria-hidden": "true" }, t)) }),
9
9
  /* @__PURE__ */ a("div", { className: "animate-pulse bg-neutral-600 h-32 w-full mt-4 rounded", "aria-hidden": "true" }),
10
10
  /* @__PURE__ */ a("span", { className: "sr-only", children: "Loading tabs…" })
11
- ] }), L = ({ ariaLabel: d, className: s, openOnLoad: i, orientation: t = "horizontal", tabValues: f = [], variant: l = "default", activationMode: m = "automatic", loading: p = !1, onError: n, onBeforeChange: h, onValueChange: v, ...y }) => {
11
+ ] }), L = ({ ariaLabel: d, className: s, openOnLoad: i, orientation: t = "horizontal", tabValues: f = [], variant: l = "default", activationMode: x = "automatic", loading: p = !1, onError: n, onBeforeChange: h, onValueChange: v, ...y }) => {
12
12
  const o = f.filter((e) => e.key !== void 0);
13
13
  if (!j(o)) {
14
14
  const e = new Error("Invalid tabValues provided to Tabs component");
@@ -34,7 +34,7 @@ const V = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ x("div", { classN
34
34
  }
35
35
  v?.(e);
36
36
  };
37
- return /* @__PURE__ */ a("div", { className: "flex flex-col relative w-full", children: /* @__PURE__ */ x(N, { "aria-label": d, className: r("relative w-full data-[orientation=vertical]:flex", l, s), defaultValue: c, orientation: t, activationMode: m, onValueChange: g, ...y, children: [
37
+ return /* @__PURE__ */ a("div", { className: "flex flex-col relative w-full", children: /* @__PURE__ */ m(N, { "aria-label": d, className: r("relative w-full data-[orientation=vertical]:flex", l, s), defaultValue: c, orientation: t, activationMode: x, onValueChange: g, ...y, children: [
38
38
  /* @__PURE__ */ a(
39
39
  T,
40
40
  {
@@ -70,12 +70,7 @@ const V = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ x("div", { classN
70
70
  k,
71
71
  {
72
72
  value: e.key,
73
- className: r(
74
- "focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent text-text-primary",
75
- t === "horizontal" && "py-6 px-4",
76
- t === "vertical" && "py-0 ps-8",
77
- "data-[state=active]:animate-fade-in-tabs"
78
- ),
73
+ className: r("focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent text-text-primary", t === "horizontal" && "py-6", t === "vertical" && "ps-8", "data-[state=active]:animate-fade-in-tabs"),
79
74
  children: e.children
80
75
  },
81
76
  e.key
package/dist/Toggle.d.ts CHANGED
@@ -2,9 +2,10 @@ import { ToggleBase } from './ToggleBase';
2
2
  import { VariantProps } from 'class-variance-authority';
3
3
  import { ComponentProps, CSSProperties } from 'react';
4
4
  export type ActiveColor = string;
5
- export declare function getActiveColorStyle(activeColor: ActiveColor | undefined): CSSProperties | undefined;
5
+ export declare function getActiveColorStyle(activeColor: ActiveColor | undefined, activeTextColor?: ActiveColor): CSSProperties | undefined;
6
6
  export type ToggleProps = ComponentProps<typeof ToggleBase> & VariantProps<typeof toggleVariants> & {
7
7
  activeColor?: ActiveColor;
8
+ activeTextColor?: ActiveColor;
8
9
  };
9
10
  export declare const toggleVariants: (props?: ({
10
11
  variant?: "default" | "outline" | null | undefined;
package/dist/Toggle.js CHANGED
@@ -1,20 +1,27 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { jsx as l } from "react/jsx-runtime";
4
- import { ToggleBase as d } from "./Toggle/ToggleBase.js";
5
- import { cn as c } from "./utils/twUtils.js";
6
- import { c as b } from "./index-D29mdTf5.js";
7
- import { forwardRef as v } from "react";
8
- const h = /^(#|rgb|hsl|oklch|oklab|lab|lch|color|var\(|transparent|currentcolor)/i;
9
- function u(e) {
10
- if (!e) return;
11
- const t = h.test(e) ? e : `var(--color-${e})`;
12
- return {
13
- "--color-toggle-bg--active": t,
14
- "--color-toggle-border--active": t
15
- };
3
+ import { jsx as c } from "react/jsx-runtime";
4
+ import { ToggleBase as v } from "./Toggle/ToggleBase.js";
5
+ import { cn as b } from "./utils/twUtils.js";
6
+ import { c as u } from "./index-D29mdTf5.js";
7
+ import { forwardRef as h } from "react";
8
+ const f = /^(#|rgb|hsl|oklch|oklab|lab|lch|color|var\(|transparent|currentcolor)/i, p = /^(success|warning|danger|primary|neutral|secondary)-\d+$/;
9
+ function r(e) {
10
+ return f.test(e) ? e : p.test(e) ? `var(--horizon-color-${e})` : `var(--color-${e})`;
16
11
  }
17
- const f = b(
12
+ function m(e, t) {
13
+ if (!(!e && !t))
14
+ return {
15
+ ...e && {
16
+ "--color-toggle-bg--active": r(e),
17
+ "--color-toggle-border--active": r(e)
18
+ },
19
+ ...t && {
20
+ "--color-toggle-text--active": r(t)
21
+ }
22
+ };
23
+ }
24
+ const x = u(
18
25
  `
19
26
  bg-toggle-bg inline-flex items-center justify-center gap-2 border rounded-md text-sm shadow-sm font-medium w-fit text-toggle-text whitespace-nowrap outline-none transition-[colors]
20
27
  [&_svg]:pointer-events-none [&_svg]:shrink-0 active:bg-toggle-bg--active hover:cursor-pointer hover:bg-toggle-bg--hover hover:border-toggle-border--hover hover:text-toggle-text--hover
@@ -44,9 +51,9 @@ const f = b(
44
51
  layout: "default"
45
52
  }
46
53
  }
47
- ), _ = v(({ className: e, variant: t, size: o, layout: r, disabled: a, activeColor: i, style: g, ...n }, s) => /* @__PURE__ */ l(d, { ref: s, disabled: a, "data-slot": "toggle", "data-testid": "spectral-toggle", className: c(f({ variant: t, size: o, layout: r }), e), style: { ...u(i), ...g }, ...n }));
54
+ ), A = h(({ className: e, variant: t, size: o, layout: a, disabled: i, activeColor: g, activeTextColor: n, style: s, ...l }, d) => /* @__PURE__ */ c(v, { ref: d, disabled: i, "data-slot": "toggle", "data-testid": "spectral-toggle", className: b(x({ variant: t, size: o, layout: a }), e), style: { ...m(g, n), ...s }, ...l }));
48
55
  export {
49
- _ as Toggle,
50
- u as getActiveColorStyle,
51
- f as toggleVariants
56
+ A as Toggle,
57
+ m as getActiveColorStyle,
58
+ x as toggleVariants
52
59
  };
@@ -4,10 +4,12 @@ import { VariantProps } from 'class-variance-authority';
4
4
  import { ComponentProps } from 'react';
5
5
  export type ToggleGroupItemProps = ComponentProps<typeof ToggleGroupItemBase> & VariantProps<typeof toggleVariants> & {
6
6
  activeColor?: ActiveColor;
7
+ activeTextColor?: ActiveColor;
7
8
  };
8
9
  export type ToggleGroupProps = ComponentProps<typeof ToggleGroupBase> & VariantProps<typeof toggleVariants> & {
9
10
  activeColor?: ActiveColor;
11
+ activeTextColor?: ActiveColor;
10
12
  };
11
- export declare const ToggleGroup: ({ className, variant, size, layout, activeColor, children, ...props }: ToggleGroupProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ToggleGroup: ({ className, variant, size, layout, activeColor, activeTextColor, children, ...props }: ToggleGroupProps) => import("react/jsx-runtime").JSX.Element;
12
14
  export declare const ToggleGroupItem: import('react').ForwardRefExoticComponent<Omit<ToggleGroupItemProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
13
15
  //# sourceMappingURL=ToggleGroup.d.ts.map
@@ -1,58 +1,58 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { jsx as g } from "react/jsx-runtime";
4
- import { ToggleGroupItemBase as b, ToggleGroupBase as x } from "./ToggleGroup/ToggleGroupBase.js";
5
- import { getActiveColorStyle as z, toggleVariants as C } from "./Toggle.js";
6
- import { cn as p } from "./utils/twUtils.js";
7
- import { createContext as G, forwardRef as T, useContext as w } from "react";
8
- const c = G({
3
+ import { jsx as s } from "react/jsx-runtime";
4
+ import { ToggleGroupItemBase as C, ToggleGroupBase as T } from "./ToggleGroup/ToggleGroupBase.js";
5
+ import { getActiveColorStyle as z, toggleVariants as G } from "./Toggle.js";
6
+ import { cn as c } from "./utils/twUtils.js";
7
+ import { createContext as w, forwardRef as h, useContext as A } from "react";
8
+ const m = w({
9
9
  size: "default",
10
10
  variant: "default",
11
11
  layout: "default"
12
- }), V = ({ className: r, variant: t, size: o, layout: e, activeColor: l, children: d, ...n }) => /* @__PURE__ */ g(
13
- x,
12
+ }), j = ({ className: r, variant: o, size: e, layout: a, activeColor: l, activeTextColor: d, children: n, ...i }) => /* @__PURE__ */ s(
13
+ T,
14
14
  {
15
15
  "data-slot": "toggle-group",
16
16
  "data-testid": "spectral-toggle-group",
17
- "data-variant": t,
18
- "data-size": o,
19
- "data-layout": e,
20
- className: p(
17
+ "data-variant": o,
18
+ "data-size": e,
19
+ "data-layout": a,
20
+ className: c(
21
21
  "group/toggle-group [&[data-variant='outline']]:bg-toggle-group-bg flex h-fit w-fit [&[data-layout='expanded']]:w-full items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md [&[data-variant='outline']]:gap-0.25",
22
22
  r
23
23
  ),
24
- ...n,
25
- children: /* @__PURE__ */ g(c.Provider, { value: { variant: t, size: o, layout: e, activeColor: l }, children: d })
24
+ ...i,
25
+ children: /* @__PURE__ */ s(m.Provider, { value: { variant: o, size: e, layout: a, activeColor: l, activeTextColor: d }, children: n })
26
26
  }
27
- ), h = T(({ className: r, children: t, variant: o, size: e, value: l, layout: d, activeColor: n, style: m, ...f }, v) => {
28
- const a = w(c), u = a.variant ?? o, i = a.size ?? e, s = a.layout ?? d, y = n ?? a.activeColor;
29
- return /* @__PURE__ */ g(
30
- b,
27
+ ), I = h(({ className: r, children: o, variant: e, size: a, value: l, layout: d, activeColor: n, activeTextColor: i, style: v, ...f }, y) => {
28
+ const t = A(m), g = t.variant ?? e, u = t.size ?? a, p = t.layout ?? d, x = n ?? t.activeColor, b = i ?? t.activeTextColor;
29
+ return /* @__PURE__ */ s(
30
+ C,
31
31
  {
32
- ref: v,
32
+ ref: y,
33
33
  "data-slot": "toggle-group-item",
34
34
  "data-testid": "spectral-toggle-group-item",
35
- "data-variant": u,
36
- "data-size": i,
37
- "data-layout": s,
35
+ "data-variant": g,
36
+ "data-size": u,
37
+ "data-layout": p,
38
38
  value: l,
39
- className: p(
40
- C({
41
- variant: u,
42
- size: i,
43
- layout: s
39
+ className: c(
40
+ G({
41
+ variant: g,
42
+ size: u,
43
+ layout: p
44
44
  }),
45
45
  "group data-[variant=outline]:border-togglegroup-border rounded-none shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0",
46
46
  r
47
47
  ),
48
- style: { ...z(y), ...m },
48
+ style: { ...z(x, b), ...v },
49
49
  ...f,
50
- children: t
50
+ children: o
51
51
  }
52
52
  );
53
53
  });
54
- h.displayName = "ToggleGroupItem";
54
+ I.displayName = "ToggleGroupItem";
55
55
  export {
56
- V as ToggleGroup,
57
- h as ToggleGroupItem
56
+ j as ToggleGroup,
57
+ I as ToggleGroupItem
58
58
  };