@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 +2 -24
- package/dist/Button.js +72 -52
- package/dist/Card.d.ts +2 -13
- package/dist/Card.js +17 -23
- package/dist/Drawer.d.ts +2 -14
- package/dist/Drawer.js +2149 -28
- package/dist/Skeleton.d.ts +2 -6
- package/dist/Skeleton.js +5 -10
- package/dist/Slider.d.ts +2 -21
- package/dist/Slider.js +534 -50
- package/dist/assets/spectral.css +1 -0
- package/dist/components/Button/Button.d.ts +20 -0
- package/dist/components/Card/Card.d.ts +9 -0
- package/dist/components/Drawer/Drawer.d.ts +10 -0
- package/dist/components/Skeleton/Skeleton.d.ts +3 -0
- package/dist/components/Slider/Slider.d.ts +18 -0
- package/dist/hooks/useAccordionAutoScroll.d.ts +8 -0
- package/dist/hooks/useOutsideClick.d.ts +7 -0
- package/dist/hooks/useTheme.d.ts +7 -0
- package/dist/index-C-ErIYr7.js +225 -0
- package/dist/index.d.ts +11 -75
- package/dist/index.js +28 -272
- package/dist/loader-circle-Btf6jOd5.js +101 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/input.d.ts +3 -0
- package/dist/primitives/tooltip.d.ts +7 -0
- package/dist/twUtils-B9ArqCOv.js +2747 -0
- package/dist/utils/twUtils.d.ts +3 -0
- package/package.json +5 -23
- package/dist/Card.css +0 -4
- package/dist/chunk-ZLENOYB4.js +0 -12
- package/dist/index.css +0 -189
package/dist/Button.d.ts
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "./
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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-${
|
|
48
|
-
isFullWidth,
|
|
49
|
-
...
|
|
50
|
-
},
|
|
51
|
-
const
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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__ */
|
|
72
|
-
/* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ f("div", { className: p("flex justify-items-center", m), children: [
|
|
92
|
+
/* @__PURE__ */ f(
|
|
73
93
|
"button",
|
|
74
94
|
{
|
|
75
|
-
className:
|
|
76
|
-
ref,
|
|
77
|
-
type,
|
|
78
|
-
"aria-disabled":
|
|
79
|
-
disabled,
|
|
80
|
-
"data-testid":
|
|
81
|
-
...
|
|
82
|
-
"data-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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "./
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
16
|
-
|
|
9
|
+
n === "full" ? "w-full" : "w-fit",
|
|
10
|
+
l
|
|
17
11
|
);
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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__ */
|
|
18
|
+
/* @__PURE__ */ e("div", { className: a("min-h-40 p-4", i && "pt-0"), children: d })
|
|
25
19
|
] });
|
|
26
20
|
}
|
|
27
21
|
);
|
|
28
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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 {}
|