@stackvibe-studio/ui 0.1.0 → 0.2.0
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/README.md +55 -0
- package/dist/components/alert.d.ts +7 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/button.d.ts +14 -3
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/select.d.ts +4 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/textarea.d.ts +4 -0
- package/dist/index.cjs +174 -22
- package/dist/index.d.ts +7 -0
- package/dist/index.js +168 -22
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @stackvibe-studio/ui
|
|
2
|
+
|
|
3
|
+
Core React component library for product teams building premium SaaS experiences.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Accessible defaults for forms, cards, alerts, and calls to action
|
|
8
|
+
- Flexible primitives with utility-friendly props
|
|
9
|
+
- Tailwind-ready styling with a compact design language
|
|
10
|
+
- New additions in v0.2.0: Tabs and Skeleton loaders
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @stackvibe-studio/ui
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Included components
|
|
19
|
+
|
|
20
|
+
- Button
|
|
21
|
+
- Badge
|
|
22
|
+
- Card
|
|
23
|
+
- Input
|
|
24
|
+
- Textarea
|
|
25
|
+
- Select
|
|
26
|
+
- Checkbox
|
|
27
|
+
- Alert
|
|
28
|
+
- Avatar
|
|
29
|
+
- Tabs
|
|
30
|
+
- Skeleton
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Button, Card, Tabs } from '@stackvibe-studio/ui';
|
|
36
|
+
|
|
37
|
+
export function Example() {
|
|
38
|
+
return (
|
|
39
|
+
<Card className="p-5">
|
|
40
|
+
<Tabs
|
|
41
|
+
items={[
|
|
42
|
+
{ id: 'overview', label: 'Overview', content: 'Overview content' },
|
|
43
|
+
{ id: 'activity', label: 'Activity', content: 'Activity content' },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
<Button className="mt-4">Launch</Button>
|
|
47
|
+
</Card>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
- Docs: https://stackvibe-studio.github.io/stackvibe-ui/
|
|
55
|
+
- Playground: https://stackvibe-studio.github.io/stackvibe-ui/playground/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export type AlertVariant = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
title?: string;
|
|
5
|
+
variant?: AlertVariant;
|
|
6
|
+
}
|
|
7
|
+
export declare function Alert({ title, variant, className, children, ...props }: AlertProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ImgHTMLAttributes } from 'react';
|
|
2
|
+
export interface AvatarProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
3
|
+
fallback?: string;
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
}
|
|
6
|
+
export declare function Avatar({ src, alt, fallback, size, className, ...props }: AvatarProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes } from 'react';
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
2
2
|
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'outline';
|
|
3
3
|
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
-
|
|
4
|
+
interface BaseButtonProps {
|
|
5
5
|
variant?: ButtonVariant;
|
|
6
6
|
size?: ButtonSize;
|
|
7
|
+
className?: string;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
type ButtonAsButtonProps = BaseButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
as?: 'button';
|
|
11
|
+
href?: never;
|
|
12
|
+
};
|
|
13
|
+
type ButtonAsAnchorProps = BaseButtonProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'type'> & {
|
|
14
|
+
as: 'a';
|
|
15
|
+
href: string;
|
|
16
|
+
};
|
|
17
|
+
export type ButtonProps = ButtonAsButtonProps | ButtonAsAnchorProps;
|
|
18
|
+
export declare function Button(props: ButtonProps): import("react").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
export * from './alert';
|
|
2
|
+
export * from './avatar';
|
|
1
3
|
export * from './badge';
|
|
2
4
|
export * from './button';
|
|
3
5
|
export * from './card';
|
|
6
|
+
export * from './checkbox';
|
|
4
7
|
export * from './input';
|
|
8
|
+
export * from './select';
|
|
9
|
+
export * from './skeleton';
|
|
10
|
+
export * from './tabs';
|
|
11
|
+
export * from './textarea';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
rounded?: 'sm' | 'md' | 'lg' | 'full';
|
|
4
|
+
}
|
|
5
|
+
export declare function Skeleton({ className, rounded, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type TabItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export interface TabsProps {
|
|
8
|
+
items: TabItem[];
|
|
9
|
+
defaultTab?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function Tabs({ items, defaultTab, className }: TabsProps): import("react").JSX.Element;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -20,24 +21,79 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
21
|
// src/index.ts
|
|
21
22
|
var index_exports = {};
|
|
22
23
|
__export(index_exports, {
|
|
24
|
+
Alert: () => Alert,
|
|
25
|
+
Avatar: () => Avatar,
|
|
23
26
|
Badge: () => Badge,
|
|
24
27
|
Button: () => Button,
|
|
25
28
|
Card: () => Card,
|
|
29
|
+
Checkbox: () => Checkbox,
|
|
26
30
|
Input: () => Input,
|
|
31
|
+
Select: () => Select,
|
|
32
|
+
Skeleton: () => Skeleton,
|
|
33
|
+
Tabs: () => Tabs,
|
|
34
|
+
Textarea: () => Textarea,
|
|
27
35
|
cx: () => cx,
|
|
28
36
|
themeTokens: () => themeTokens
|
|
29
37
|
});
|
|
30
38
|
module.exports = __toCommonJS(index_exports);
|
|
31
39
|
|
|
32
|
-
// src/components/
|
|
40
|
+
// src/components/alert.tsx
|
|
33
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var variantClasses = {
|
|
43
|
+
info: "border-cyan-500/40 bg-cyan-500/10 text-cyan-50",
|
|
44
|
+
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
|
|
45
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
|
|
46
|
+
danger: "border-rose-500/40 bg-rose-500/10 text-rose-50"
|
|
47
|
+
};
|
|
48
|
+
function Alert({ title, variant = "info", className = "", children, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
className: ["rounded-2xl border p-4 text-sm", variantClasses[variant], className].join(" "),
|
|
54
|
+
role: "alert",
|
|
55
|
+
children: [
|
|
56
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mb-1 font-medium", children: title }) : null,
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children })
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/components/avatar.tsx
|
|
64
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
65
|
+
var sizeClasses = {
|
|
66
|
+
sm: "h-9 w-9 text-xs",
|
|
67
|
+
md: "h-12 w-12 text-sm",
|
|
68
|
+
lg: "h-16 w-16 text-base"
|
|
69
|
+
};
|
|
70
|
+
function Avatar({ src, alt = "avatar", fallback = "SV", size = "md", className = "", ...props }) {
|
|
71
|
+
return src ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
72
|
+
"img",
|
|
73
|
+
{
|
|
74
|
+
...props,
|
|
75
|
+
src,
|
|
76
|
+
alt,
|
|
77
|
+
className: ["rounded-full object-cover ring-1 ring-white/10", sizeClasses[size], className].join(" ")
|
|
78
|
+
}
|
|
79
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: ["flex items-center justify-center rounded-full bg-violet-500/20 font-semibold text-violet-100 ring-1 ring-violet-400/20", sizeClasses[size], className].join(" "),
|
|
83
|
+
children: fallback
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/components/badge.tsx
|
|
89
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
34
90
|
var variants = {
|
|
35
91
|
primary: "bg-violet-500/20 text-violet-200 ring-1 ring-violet-400/20",
|
|
36
92
|
secondary: "bg-cyan-500/15 text-cyan-200 ring-1 ring-cyan-400/20",
|
|
37
93
|
outline: "bg-transparent text-slate-200 ring-1 ring-white/10"
|
|
38
94
|
};
|
|
39
95
|
function Badge({ variant = "primary", className = "", ...props }) {
|
|
40
|
-
return /* @__PURE__ */ (0,
|
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
41
97
|
"span",
|
|
42
98
|
{
|
|
43
99
|
...props,
|
|
@@ -47,37 +103,38 @@ function Badge({ variant = "primary", className = "", ...props }) {
|
|
|
47
103
|
}
|
|
48
104
|
|
|
49
105
|
// src/components/button.tsx
|
|
50
|
-
var
|
|
51
|
-
var
|
|
106
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
107
|
+
var variantClasses2 = {
|
|
52
108
|
primary: "bg-violet-500 text-white hover:bg-violet-400",
|
|
53
109
|
secondary: "bg-cyan-500 text-slate-950 hover:bg-cyan-400",
|
|
54
110
|
ghost: "bg-white/5 text-white hover:bg-white/10",
|
|
55
111
|
outline: "border border-white/15 bg-transparent text-white hover:bg-white/5"
|
|
56
112
|
};
|
|
57
|
-
var
|
|
113
|
+
var sizeClasses2 = {
|
|
58
114
|
sm: "px-3 py-1.5 text-sm",
|
|
59
115
|
md: "px-4 py-2 text-sm",
|
|
60
116
|
lg: "px-5 py-3 text-base"
|
|
61
117
|
};
|
|
62
|
-
function Button(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
118
|
+
function Button(props) {
|
|
119
|
+
const { as = "button", variant = "primary", size = "md", className = "", ...rest } = props;
|
|
120
|
+
const commonClassName = [
|
|
121
|
+
"inline-flex items-center justify-center rounded-xl font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400",
|
|
122
|
+
variantClasses2[variant],
|
|
123
|
+
sizeClasses2[size],
|
|
124
|
+
className
|
|
125
|
+
].join(" ");
|
|
126
|
+
if (as === "a") {
|
|
127
|
+
const { href, ...anchorProps } = rest;
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { ...anchorProps, href, className: commonClassName });
|
|
129
|
+
}
|
|
130
|
+
const { type = "button", ...buttonProps } = rest;
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { ...buttonProps, type, className: commonClassName });
|
|
75
132
|
}
|
|
76
133
|
|
|
77
134
|
// src/components/card.tsx
|
|
78
|
-
var
|
|
135
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
79
136
|
function Card({ as: Component = "div", className = "", ...props }) {
|
|
80
|
-
return /* @__PURE__ */ (0,
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
81
138
|
Component,
|
|
82
139
|
{
|
|
83
140
|
...props,
|
|
@@ -89,10 +146,23 @@ function Card({ as: Component = "div", className = "", ...props }) {
|
|
|
89
146
|
);
|
|
90
147
|
}
|
|
91
148
|
|
|
149
|
+
// src/components/checkbox.tsx
|
|
150
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
151
|
+
function Checkbox({ className = "", ...props }) {
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
153
|
+
"input",
|
|
154
|
+
{
|
|
155
|
+
...props,
|
|
156
|
+
type: "checkbox",
|
|
157
|
+
className: ["h-4 w-4 rounded border border-white/20 bg-slate-900 text-violet-500 focus:ring-violet-400/40", className].join(" ")
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
92
162
|
// src/components/input.tsx
|
|
93
|
-
var
|
|
163
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
94
164
|
function Input({ className = "", ...props }) {
|
|
95
|
-
return /* @__PURE__ */ (0,
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
96
166
|
"input",
|
|
97
167
|
{
|
|
98
168
|
...props,
|
|
@@ -104,6 +174,81 @@ function Input({ className = "", ...props }) {
|
|
|
104
174
|
);
|
|
105
175
|
}
|
|
106
176
|
|
|
177
|
+
// src/components/select.tsx
|
|
178
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
179
|
+
function Select({ className = "", children, ...props }) {
|
|
180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
181
|
+
"select",
|
|
182
|
+
{
|
|
183
|
+
...props,
|
|
184
|
+
className: [
|
|
185
|
+
"w-full rounded-xl border border-white/10 bg-slate-900 px-3 py-2 text-sm text-white focus:border-violet-400 focus:outline-none focus:ring-2 focus:ring-violet-400/30",
|
|
186
|
+
className
|
|
187
|
+
].join(" "),
|
|
188
|
+
children
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/components/skeleton.tsx
|
|
194
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
195
|
+
var roundedClasses = {
|
|
196
|
+
sm: "rounded-md",
|
|
197
|
+
md: "rounded-xl",
|
|
198
|
+
lg: "rounded-2xl",
|
|
199
|
+
full: "rounded-full"
|
|
200
|
+
};
|
|
201
|
+
function Skeleton({ className = "", rounded = "md", ...props }) {
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
...props,
|
|
206
|
+
className: ["animate-pulse bg-slate-700/70", roundedClasses[rounded], className].join(" "),
|
|
207
|
+
"aria-hidden": "true"
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/components/tabs.tsx
|
|
213
|
+
var import_react = require("react");
|
|
214
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
215
|
+
function Tabs({ items, defaultTab, className = "" }) {
|
|
216
|
+
const initialTab = defaultTab ?? items[0]?.id ?? "";
|
|
217
|
+
const [activeTab, setActiveTab] = (0, import_react.useState)(initialTab);
|
|
218
|
+
const activeItem = items.find((item) => item.id === activeTab) ?? items[0];
|
|
219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className, children: [
|
|
220
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mb-4 flex flex-wrap gap-2", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
221
|
+
"button",
|
|
222
|
+
{
|
|
223
|
+
type: "button",
|
|
224
|
+
onClick: () => setActiveTab(item.id),
|
|
225
|
+
className: [
|
|
226
|
+
"rounded-full px-3 py-1.5 text-sm transition",
|
|
227
|
+
item.id === activeItem?.id ? "bg-violet-500 text-white shadow-lg shadow-violet-500/20" : "bg-slate-800 text-slate-300 hover:bg-slate-700 hover:text-white"
|
|
228
|
+
].join(" "),
|
|
229
|
+
children: item.label
|
|
230
|
+
},
|
|
231
|
+
item.id
|
|
232
|
+
)) }),
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "rounded-2xl border border-white/10 bg-slate-950/60 p-4 text-sm text-slate-200", children: activeItem?.content })
|
|
234
|
+
] });
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/components/textarea.tsx
|
|
238
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
239
|
+
function Textarea({ className = "", ...props }) {
|
|
240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
241
|
+
"textarea",
|
|
242
|
+
{
|
|
243
|
+
...props,
|
|
244
|
+
className: [
|
|
245
|
+
"w-full rounded-xl border border-white/10 bg-slate-900 px-3 py-2 text-sm text-white placeholder:text-slate-400 focus:border-violet-400 focus:outline-none focus:ring-2 focus:ring-violet-400/30",
|
|
246
|
+
className
|
|
247
|
+
].join(" ")
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
107
252
|
// src/tokens/index.ts
|
|
108
253
|
var themeTokens = {
|
|
109
254
|
colors: {
|
|
@@ -122,10 +267,17 @@ var themeTokens = {
|
|
|
122
267
|
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
123
268
|
// Annotate the CommonJS export names for ESM import in node:
|
|
124
269
|
0 && (module.exports = {
|
|
270
|
+
Alert,
|
|
271
|
+
Avatar,
|
|
125
272
|
Badge,
|
|
126
273
|
Button,
|
|
127
274
|
Card,
|
|
275
|
+
Checkbox,
|
|
128
276
|
Input,
|
|
277
|
+
Select,
|
|
278
|
+
Skeleton,
|
|
279
|
+
Tabs,
|
|
280
|
+
Textarea,
|
|
129
281
|
cx,
|
|
130
282
|
themeTokens
|
|
131
283
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
export * from './components/alert';
|
|
2
|
+
export * from './components/avatar';
|
|
1
3
|
export * from './components/badge';
|
|
2
4
|
export * from './components/button';
|
|
3
5
|
export * from './components/card';
|
|
6
|
+
export * from './components/checkbox';
|
|
4
7
|
export * from './components/input';
|
|
8
|
+
export * from './components/select';
|
|
9
|
+
export * from './components/skeleton';
|
|
10
|
+
export * from './components/tabs';
|
|
11
|
+
export * from './components/textarea';
|
|
5
12
|
export * from './tokens';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/alert.tsx
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
var variantClasses = {
|
|
6
|
+
info: "border-cyan-500/40 bg-cyan-500/10 text-cyan-50",
|
|
7
|
+
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
|
|
8
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
|
|
9
|
+
danger: "border-rose-500/40 bg-rose-500/10 text-rose-50"
|
|
10
|
+
};
|
|
11
|
+
function Alert({ title, variant = "info", className = "", children, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
...props,
|
|
16
|
+
className: ["rounded-2xl border p-4 text-sm", variantClasses[variant], className].join(" "),
|
|
17
|
+
role: "alert",
|
|
18
|
+
children: [
|
|
19
|
+
title ? /* @__PURE__ */ jsx("p", { className: "mb-1 font-medium", children: title }) : null,
|
|
20
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/components/avatar.tsx
|
|
27
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
28
|
+
var sizeClasses = {
|
|
29
|
+
sm: "h-9 w-9 text-xs",
|
|
30
|
+
md: "h-12 w-12 text-sm",
|
|
31
|
+
lg: "h-16 w-16 text-base"
|
|
32
|
+
};
|
|
33
|
+
function Avatar({ src, alt = "avatar", fallback = "SV", size = "md", className = "", ...props }) {
|
|
34
|
+
return src ? /* @__PURE__ */ jsx2(
|
|
35
|
+
"img",
|
|
36
|
+
{
|
|
37
|
+
...props,
|
|
38
|
+
src,
|
|
39
|
+
alt,
|
|
40
|
+
className: ["rounded-full object-cover ring-1 ring-white/10", sizeClasses[size], className].join(" ")
|
|
41
|
+
}
|
|
42
|
+
) : /* @__PURE__ */ jsx2(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: ["flex items-center justify-center rounded-full bg-violet-500/20 font-semibold text-violet-100 ring-1 ring-violet-400/20", sizeClasses[size], className].join(" "),
|
|
46
|
+
children: fallback
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
1
51
|
// src/components/badge.tsx
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
52
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3
53
|
var variants = {
|
|
4
54
|
primary: "bg-violet-500/20 text-violet-200 ring-1 ring-violet-400/20",
|
|
5
55
|
secondary: "bg-cyan-500/15 text-cyan-200 ring-1 ring-cyan-400/20",
|
|
6
56
|
outline: "bg-transparent text-slate-200 ring-1 ring-white/10"
|
|
7
57
|
};
|
|
8
58
|
function Badge({ variant = "primary", className = "", ...props }) {
|
|
9
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ jsx3(
|
|
10
60
|
"span",
|
|
11
61
|
{
|
|
12
62
|
...props,
|
|
@@ -16,37 +66,38 @@ function Badge({ variant = "primary", className = "", ...props }) {
|
|
|
16
66
|
}
|
|
17
67
|
|
|
18
68
|
// src/components/button.tsx
|
|
19
|
-
import { jsx as
|
|
20
|
-
var
|
|
69
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
70
|
+
var variantClasses2 = {
|
|
21
71
|
primary: "bg-violet-500 text-white hover:bg-violet-400",
|
|
22
72
|
secondary: "bg-cyan-500 text-slate-950 hover:bg-cyan-400",
|
|
23
73
|
ghost: "bg-white/5 text-white hover:bg-white/10",
|
|
24
74
|
outline: "border border-white/15 bg-transparent text-white hover:bg-white/5"
|
|
25
75
|
};
|
|
26
|
-
var
|
|
76
|
+
var sizeClasses2 = {
|
|
27
77
|
sm: "px-3 py-1.5 text-sm",
|
|
28
78
|
md: "px-4 py-2 text-sm",
|
|
29
79
|
lg: "px-5 py-3 text-base"
|
|
30
80
|
};
|
|
31
|
-
function Button(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
81
|
+
function Button(props) {
|
|
82
|
+
const { as = "button", variant = "primary", size = "md", className = "", ...rest } = props;
|
|
83
|
+
const commonClassName = [
|
|
84
|
+
"inline-flex items-center justify-center rounded-xl font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400",
|
|
85
|
+
variantClasses2[variant],
|
|
86
|
+
sizeClasses2[size],
|
|
87
|
+
className
|
|
88
|
+
].join(" ");
|
|
89
|
+
if (as === "a") {
|
|
90
|
+
const { href, ...anchorProps } = rest;
|
|
91
|
+
return /* @__PURE__ */ jsx4("a", { ...anchorProps, href, className: commonClassName });
|
|
92
|
+
}
|
|
93
|
+
const { type = "button", ...buttonProps } = rest;
|
|
94
|
+
return /* @__PURE__ */ jsx4("button", { ...buttonProps, type, className: commonClassName });
|
|
44
95
|
}
|
|
45
96
|
|
|
46
97
|
// src/components/card.tsx
|
|
47
|
-
import { jsx as
|
|
98
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
48
99
|
function Card({ as: Component = "div", className = "", ...props }) {
|
|
49
|
-
return /* @__PURE__ */
|
|
100
|
+
return /* @__PURE__ */ jsx5(
|
|
50
101
|
Component,
|
|
51
102
|
{
|
|
52
103
|
...props,
|
|
@@ -58,10 +109,23 @@ function Card({ as: Component = "div", className = "", ...props }) {
|
|
|
58
109
|
);
|
|
59
110
|
}
|
|
60
111
|
|
|
112
|
+
// src/components/checkbox.tsx
|
|
113
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
114
|
+
function Checkbox({ className = "", ...props }) {
|
|
115
|
+
return /* @__PURE__ */ jsx6(
|
|
116
|
+
"input",
|
|
117
|
+
{
|
|
118
|
+
...props,
|
|
119
|
+
type: "checkbox",
|
|
120
|
+
className: ["h-4 w-4 rounded border border-white/20 bg-slate-900 text-violet-500 focus:ring-violet-400/40", className].join(" ")
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
61
125
|
// src/components/input.tsx
|
|
62
|
-
import { jsx as
|
|
126
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
63
127
|
function Input({ className = "", ...props }) {
|
|
64
|
-
return /* @__PURE__ */
|
|
128
|
+
return /* @__PURE__ */ jsx7(
|
|
65
129
|
"input",
|
|
66
130
|
{
|
|
67
131
|
...props,
|
|
@@ -73,6 +137,81 @@ function Input({ className = "", ...props }) {
|
|
|
73
137
|
);
|
|
74
138
|
}
|
|
75
139
|
|
|
140
|
+
// src/components/select.tsx
|
|
141
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
142
|
+
function Select({ className = "", children, ...props }) {
|
|
143
|
+
return /* @__PURE__ */ jsx8(
|
|
144
|
+
"select",
|
|
145
|
+
{
|
|
146
|
+
...props,
|
|
147
|
+
className: [
|
|
148
|
+
"w-full rounded-xl border border-white/10 bg-slate-900 px-3 py-2 text-sm text-white focus:border-violet-400 focus:outline-none focus:ring-2 focus:ring-violet-400/30",
|
|
149
|
+
className
|
|
150
|
+
].join(" "),
|
|
151
|
+
children
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/components/skeleton.tsx
|
|
157
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
158
|
+
var roundedClasses = {
|
|
159
|
+
sm: "rounded-md",
|
|
160
|
+
md: "rounded-xl",
|
|
161
|
+
lg: "rounded-2xl",
|
|
162
|
+
full: "rounded-full"
|
|
163
|
+
};
|
|
164
|
+
function Skeleton({ className = "", rounded = "md", ...props }) {
|
|
165
|
+
return /* @__PURE__ */ jsx9(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
...props,
|
|
169
|
+
className: ["animate-pulse bg-slate-700/70", roundedClasses[rounded], className].join(" "),
|
|
170
|
+
"aria-hidden": "true"
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/components/tabs.tsx
|
|
176
|
+
import { useState } from "react";
|
|
177
|
+
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
178
|
+
function Tabs({ items, defaultTab, className = "" }) {
|
|
179
|
+
const initialTab = defaultTab ?? items[0]?.id ?? "";
|
|
180
|
+
const [activeTab, setActiveTab] = useState(initialTab);
|
|
181
|
+
const activeItem = items.find((item) => item.id === activeTab) ?? items[0];
|
|
182
|
+
return /* @__PURE__ */ jsxs2("div", { className, children: [
|
|
183
|
+
/* @__PURE__ */ jsx10("div", { className: "mb-4 flex flex-wrap gap-2", children: items.map((item) => /* @__PURE__ */ jsx10(
|
|
184
|
+
"button",
|
|
185
|
+
{
|
|
186
|
+
type: "button",
|
|
187
|
+
onClick: () => setActiveTab(item.id),
|
|
188
|
+
className: [
|
|
189
|
+
"rounded-full px-3 py-1.5 text-sm transition",
|
|
190
|
+
item.id === activeItem?.id ? "bg-violet-500 text-white shadow-lg shadow-violet-500/20" : "bg-slate-800 text-slate-300 hover:bg-slate-700 hover:text-white"
|
|
191
|
+
].join(" "),
|
|
192
|
+
children: item.label
|
|
193
|
+
},
|
|
194
|
+
item.id
|
|
195
|
+
)) }),
|
|
196
|
+
/* @__PURE__ */ jsx10("div", { className: "rounded-2xl border border-white/10 bg-slate-950/60 p-4 text-sm text-slate-200", children: activeItem?.content })
|
|
197
|
+
] });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/components/textarea.tsx
|
|
201
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
202
|
+
function Textarea({ className = "", ...props }) {
|
|
203
|
+
return /* @__PURE__ */ jsx11(
|
|
204
|
+
"textarea",
|
|
205
|
+
{
|
|
206
|
+
...props,
|
|
207
|
+
className: [
|
|
208
|
+
"w-full rounded-xl border border-white/10 bg-slate-900 px-3 py-2 text-sm text-white placeholder:text-slate-400 focus:border-violet-400 focus:outline-none focus:ring-2 focus:ring-violet-400/30",
|
|
209
|
+
className
|
|
210
|
+
].join(" ")
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
76
215
|
// src/tokens/index.ts
|
|
77
216
|
var themeTokens = {
|
|
78
217
|
colors: {
|
|
@@ -90,10 +229,17 @@ var themeTokens = {
|
|
|
90
229
|
};
|
|
91
230
|
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
92
231
|
export {
|
|
232
|
+
Alert,
|
|
233
|
+
Avatar,
|
|
93
234
|
Badge,
|
|
94
235
|
Button,
|
|
95
236
|
Card,
|
|
237
|
+
Checkbox,
|
|
96
238
|
Input,
|
|
239
|
+
Select,
|
|
240
|
+
Skeleton,
|
|
241
|
+
Tabs,
|
|
242
|
+
Textarea,
|
|
97
243
|
cx,
|
|
98
244
|
themeTokens
|
|
99
245
|
};
|