@spear-ai/spectral 1.0.0 → 1.0.1

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/Button.d.ts CHANGED
@@ -1,24 +1,2 @@
1
- import * as react from 'react';
2
- import { ButtonHTMLAttributes, ReactNode, MouseEvent } from 'react';
3
- import * as class_variance_authority_types from 'class-variance-authority/types';
4
- import { VariantProps } from 'class-variance-authority';
5
-
6
- declare const buttonVariants: (props?: ({
7
- variant?: "primary" | "secondary" | "outline" | null | undefined;
8
- state?: "default" | "error" | "loading" | null | undefined;
9
- } & class_variance_authority_types.ClassProp) | undefined) => string;
10
- interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>, VariantProps<typeof buttonVariants> {
11
- errorMessage?: string | ReactNode;
12
- endIcon?: ReactNode;
13
- label: string;
14
- disabled?: boolean;
15
- startIcon?: ReactNode;
16
- type?: 'button' | 'submit' | 'reset';
17
- state?: 'loading' | 'error' | 'default';
18
- dataTestId?: string;
19
- onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
20
- isFullWidth?: boolean;
21
- }
22
- declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
23
-
24
- export { Button, type ButtonProps };
1
+ export * from './components/Button/Button'
2
+ export {}
package/dist/Button.js CHANGED
@@ -1,14 +1,37 @@
1
- "use client"
2
- import {
3
- cn
4
- } from "./chunk-ZLENOYB4.js";
5
-
6
- // src/components/Button/Button.tsx
7
- import { cva } from "class-variance-authority";
8
- import { Loader2 } from "lucide-react";
9
- import { forwardRef } from "react";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- var buttonVariants = cva(
1
+ import { jsxs as f, jsx as v } from "react/jsx-runtime";
2
+ import { a as V, c as p } from "./twUtils-B9ArqCOv.js";
3
+ import { forwardRef as j } from "react";
4
+ import { L as w } from "./loader-circle-Btf6jOd5.js";
5
+ const N = (o) => typeof o == "boolean" ? `${o}` : o === 0 ? "0" : o, h = V, C = (o, e) => (t) => {
6
+ var l;
7
+ if (e?.variants == null) return h(o, t?.class, t?.className);
8
+ const { variants: r, defaultVariants: i } = e, u = Object.keys(r).map((n) => {
9
+ const a = t?.[n], s = i?.[n];
10
+ if (a === null) return null;
11
+ const d = N(a) || N(s);
12
+ return r[n][d];
13
+ }), b = t && Object.entries(t).reduce((n, a) => {
14
+ let [s, d] = a;
15
+ return d === void 0 || (n[s] = d), n;
16
+ }, {}), y = e == null || (l = e.compoundVariants) === null || l === void 0 ? void 0 : l.reduce((n, a) => {
17
+ let { class: s, className: d, ...c } = a;
18
+ return Object.entries(c).every((m) => {
19
+ let [g, x] = m;
20
+ return Array.isArray(x) ? x.includes({
21
+ ...i,
22
+ ...b
23
+ }[g]) : {
24
+ ...i,
25
+ ...b
26
+ }[g] === x;
27
+ }) ? [
28
+ ...n,
29
+ s,
30
+ d
31
+ ] : n;
32
+ }, []);
33
+ return h(o, u, y, t?.class, t?.className);
34
+ }, _ = C(
12
35
  `
13
36
  flex relative items-center justify-center gap-2 whitespace-nowrap transition-colors cursor-pointer py-2 px-6 rounded-lg border font-semibold
14
37
  focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus:ring-2 focus:ring-ring focus:ring-offset-2
@@ -32,23 +55,22 @@ var buttonVariants = cva(
32
55
  state: "default"
33
56
  }
34
57
  }
35
- );
36
- var Button = forwardRef(
58
+ ), k = j(
37
59
  ({
38
- className,
39
- variant,
40
- label,
41
- endIcon,
42
- state,
43
- errorMessage,
44
- startIcon,
45
- disabled,
46
- type = "button",
47
- dataTestId = `button-${variant}`,
48
- isFullWidth,
49
- ...props
50
- }, ref) => {
51
- const stateStyles = {
60
+ className: o,
61
+ variant: e,
62
+ label: t,
63
+ endIcon: l,
64
+ state: r,
65
+ errorMessage: i,
66
+ startIcon: u,
67
+ disabled: b,
68
+ type: y = "button",
69
+ dataTestId: n = `button-${e}`,
70
+ isFullWidth: a,
71
+ ...s
72
+ }, d) => {
73
+ const c = {
52
74
  error: {
53
75
  primary: "bg-button-danger border-button-danger text-button-primary-text pointer-events-none",
54
76
  secondary: "bg-button-danger border-button-danger text-button-secondary-text pointer-events-none",
@@ -59,40 +81,38 @@ var Button = forwardRef(
59
81
  secondary: "bg-button-secondary-bg--disabled border-button-secondary-border--disabled text-button-secondary-text--disabled pointer-events-none",
60
82
  outline: "bg-button-outline-bg--disabled border-button-outline-border--disabled text-button-outline-text--disabled pointer-events-none"
61
83
  }
62
- };
63
- const widthClass = isFullWidth ? "w-full" : "w-auto";
64
- const classes = cn(
65
- buttonVariants({ variant, state }),
66
- state === "error" && stateStyles.error[variant || "primary"],
67
- state === "loading" && stateStyles.loading[variant || "primary"],
68
- widthClass,
69
- className
84
+ }, m = a ? "w-full" : "w-auto", g = p(
85
+ _({ variant: e, state: r }),
86
+ r === "error" && c.error[e || "primary"],
87
+ r === "loading" && c.loading[e || "primary"],
88
+ m,
89
+ o
70
90
  );
71
- return /* @__PURE__ */ jsxs("div", { className: cn("flex justify-items-center", widthClass), children: [
72
- /* @__PURE__ */ jsxs(
91
+ return /* @__PURE__ */ f("div", { className: p("flex justify-items-center", m), children: [
92
+ /* @__PURE__ */ f(
73
93
  "button",
74
94
  {
75
- className: classes,
76
- ref,
77
- type,
78
- "aria-disabled": disabled,
79
- disabled,
80
- "data-testid": dataTestId,
81
- ...props,
82
- "data-state": state,
95
+ className: g,
96
+ ref: d,
97
+ type: y,
98
+ "aria-disabled": b,
99
+ disabled: b,
100
+ "data-testid": n,
101
+ ...s,
102
+ "data-state": r,
83
103
  children: [
84
- startIcon && /* @__PURE__ */ jsx("span", { className: "flex pr-2", "aria-hidden": true, children: startIcon }),
85
- label,
86
- state === "loading" && /* @__PURE__ */ jsx(Loader2, { className: "ml-2 animate-spin", size: 16 }),
87
- endIcon && state !== "loading" && /* @__PURE__ */ jsx("span", { className: "flex pl-2", "aria-hidden": true, children: endIcon })
104
+ u && /* @__PURE__ */ v("span", { className: "flex pr-2", "aria-hidden": !0, children: u }),
105
+ t,
106
+ r === "loading" && /* @__PURE__ */ v(w, { className: "ml-2 animate-spin", size: 16 }),
107
+ l && r !== "loading" && /* @__PURE__ */ v("span", { className: "flex pl-2", "aria-hidden": !0, children: l })
88
108
  ]
89
109
  }
90
110
  ),
91
- state === "error" && errorMessage && /* @__PURE__ */ jsx("p", { className: "text-danger text-xs", role: "alert", "aria-live": "polite", children: errorMessage })
111
+ r === "error" && i && /* @__PURE__ */ v("p", { className: "text-danger text-xs", role: "alert", "aria-live": "polite", children: i })
92
112
  ] });
93
113
  }
94
114
  );
95
- Button.displayName = "Button";
115
+ k.displayName = "Button";
96
116
  export {
97
- Button
117
+ k as Button
98
118
  };
package/dist/Card.d.ts CHANGED
@@ -1,13 +1,2 @@
1
- import * as react from 'react';
2
- import { HTMLAttributes, ReactNode } from 'react';
3
-
4
- interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
5
- title?: string;
6
- icon?: ReactNode;
7
- width?: 'full' | 'fit';
8
- isLoading?: boolean;
9
- children?: ReactNode;
10
- }
11
- declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
12
-
13
- export { Card, type CardProps };
1
+ export * from './components/Card/Card'
2
+ export {}
package/dist/Card.js CHANGED
@@ -1,31 +1,25 @@
1
- "use client"
2
- import {
3
- cn
4
- } from "./chunk-ZLENOYB4.js";
5
-
6
- // src/components/Card/Card.tsx
7
- import { Loader2 } from "lucide-react";
8
- import { forwardRef } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var Card = forwardRef(
11
- ({ className, title, icon, width = "full", isLoading = false, children, ...props }, ref) => {
12
- const hasHeader = title || icon;
13
- const cardClasses = cn(
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { c as a } from "./twUtils-B9ArqCOv.js";
3
+ import { forwardRef as u } from "react";
4
+ import { L as b } from "./loader-circle-Btf6jOd5.js";
5
+ const p = u(
6
+ ({ className: l, title: s, icon: r, width: n = "full", isLoading: c = !1, children: d, ...f }, o) => {
7
+ const i = s || r, m = a(
14
8
  "relative bg-card-bg rounded-2xl p-4 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
15
- width === "full" ? "w-full" : "w-fit",
16
- className
9
+ n === "full" ? "w-full" : "w-fit",
10
+ l
17
11
  );
18
- return /* @__PURE__ */ jsxs("div", { ref, className: cardClasses, ...props, children: [
19
- isLoading && /* @__PURE__ */ jsx("div", { className: "bg-card-bg/50 absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader2, { className: "text-muted-foreground animate-spin", size: 24 }) }),
20
- hasHeader && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center pb-4", title ? "justify-between" : "justify-end"), children: [
21
- title && /* @__PURE__ */ jsx("h3", { className: "text-card-text truncate text-base font-semibold", children: title }),
22
- icon && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", "aria-hidden": "true", children: icon })
12
+ return /* @__PURE__ */ t("div", { ref: o, className: m, ...f, children: [
13
+ c && /* @__PURE__ */ e("div", { className: "bg-card-bg/50 absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ e(b, { className: "text-muted-foreground animate-spin", size: 24 }) }),
14
+ i && /* @__PURE__ */ t("div", { className: a("flex items-center pb-4", s ? "justify-between" : "justify-end"), children: [
15
+ s && /* @__PURE__ */ e("h3", { className: "text-card-text truncate text-base font-semibold", children: s }),
16
+ r && /* @__PURE__ */ e("div", { className: "flex-shrink-0", "aria-hidden": "true", children: r })
23
17
  ] }),
24
- /* @__PURE__ */ jsx("div", { className: cn("min-h-40 p-4", hasHeader && "pt-0"), children })
18
+ /* @__PURE__ */ e("div", { className: a("min-h-40 p-4", i && "pt-0"), children: d })
25
19
  ] });
26
20
  }
27
21
  );
28
- Card.displayName = "Card";
22
+ p.displayName = "Card";
29
23
  export {
30
- Card
24
+ p as Card
31
25
  };
package/dist/Drawer.d.ts CHANGED
@@ -1,14 +1,2 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
3
-
4
- type DrawerProps = {
5
- title?: string;
6
- trigger: ReactNode;
7
- description?: string;
8
- children?: ReactNode;
9
- direction?: 'left' | 'right' | 'top' | 'bottom';
10
- size?: string;
11
- };
12
- declare const Drawer: ({ trigger, title, description, children, direction, size }: DrawerProps) => react_jsx_runtime.JSX.Element;
13
-
14
- export { Drawer, type DrawerProps };
1
+ export * from './components/Drawer/Drawer'
2
+ export {}