@stackvibe-studio/ui 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +54 -2
- package/dist/components/alert.d.ts +7 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/badge.d.ts +6 -0
- package/dist/components/button.d.ts +19 -0
- package/dist/components/card.d.ts +5 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/input.d.ts +4 -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 +283 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +245 -0
- package/dist/tokens/index.d.ts +16 -0
- package/package.json +44 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 StackVibe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @stackvibe-studio/ui
|
|
2
2
|
|
|
3
|
-
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export type BadgeVariant = 'primary' | 'secondary' | 'outline';
|
|
3
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
variant?: BadgeVariant;
|
|
5
|
+
}
|
|
6
|
+
export declare function Badge({ variant, className, ...props }: BadgeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'outline';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
interface BaseButtonProps {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
className?: string;
|
|
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 {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './alert';
|
|
2
|
+
export * from './avatar';
|
|
3
|
+
export * from './badge';
|
|
4
|
+
export * from './button';
|
|
5
|
+
export * from './card';
|
|
6
|
+
export * from './checkbox';
|
|
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
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
Alert: () => Alert,
|
|
25
|
+
Avatar: () => Avatar,
|
|
26
|
+
Badge: () => Badge,
|
|
27
|
+
Button: () => Button,
|
|
28
|
+
Card: () => Card,
|
|
29
|
+
Checkbox: () => Checkbox,
|
|
30
|
+
Input: () => Input,
|
|
31
|
+
Select: () => Select,
|
|
32
|
+
Skeleton: () => Skeleton,
|
|
33
|
+
Tabs: () => Tabs,
|
|
34
|
+
Textarea: () => Textarea,
|
|
35
|
+
cx: () => cx,
|
|
36
|
+
themeTokens: () => themeTokens
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
|
|
40
|
+
// src/components/alert.tsx
|
|
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");
|
|
90
|
+
var variants = {
|
|
91
|
+
primary: "bg-violet-500/20 text-violet-200 ring-1 ring-violet-400/20",
|
|
92
|
+
secondary: "bg-cyan-500/15 text-cyan-200 ring-1 ring-cyan-400/20",
|
|
93
|
+
outline: "bg-transparent text-slate-200 ring-1 ring-white/10"
|
|
94
|
+
};
|
|
95
|
+
function Badge({ variant = "primary", className = "", ...props }) {
|
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
...props,
|
|
100
|
+
className: ["inline-flex items-center rounded-full px-2.5 py-1 text-xs font-medium", variants[variant], className].join(" ")
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/components/button.tsx
|
|
106
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
107
|
+
var variantClasses2 = {
|
|
108
|
+
primary: "bg-violet-500 text-white hover:bg-violet-400",
|
|
109
|
+
secondary: "bg-cyan-500 text-slate-950 hover:bg-cyan-400",
|
|
110
|
+
ghost: "bg-white/5 text-white hover:bg-white/10",
|
|
111
|
+
outline: "border border-white/15 bg-transparent text-white hover:bg-white/5"
|
|
112
|
+
};
|
|
113
|
+
var sizeClasses2 = {
|
|
114
|
+
sm: "px-3 py-1.5 text-sm",
|
|
115
|
+
md: "px-4 py-2 text-sm",
|
|
116
|
+
lg: "px-5 py-3 text-base"
|
|
117
|
+
};
|
|
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 });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/components/card.tsx
|
|
135
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
136
|
+
function Card({ as: Component = "div", className = "", ...props }) {
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
138
|
+
Component,
|
|
139
|
+
{
|
|
140
|
+
...props,
|
|
141
|
+
className: [
|
|
142
|
+
"rounded-2xl border border-white/10 bg-slate-950/50 p-4 shadow-lg shadow-slate-950/20 backdrop-blur-sm",
|
|
143
|
+
className
|
|
144
|
+
].join(" ")
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
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
|
+
|
|
162
|
+
// src/components/input.tsx
|
|
163
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
164
|
+
function Input({ className = "", ...props }) {
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
166
|
+
"input",
|
|
167
|
+
{
|
|
168
|
+
...props,
|
|
169
|
+
className: [
|
|
170
|
+
"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",
|
|
171
|
+
className
|
|
172
|
+
].join(" ")
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
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
|
+
|
|
252
|
+
// src/tokens/index.ts
|
|
253
|
+
var themeTokens = {
|
|
254
|
+
colors: {
|
|
255
|
+
primary: "var(--sv-primary, 139 92 246)",
|
|
256
|
+
background: "var(--sv-background, 15 23 42)",
|
|
257
|
+
foreground: "var(--sv-foreground, 248 250 252)",
|
|
258
|
+
accent: "var(--sv-accent, 34 211 238)"
|
|
259
|
+
},
|
|
260
|
+
radius: {
|
|
261
|
+
sm: "var(--sv-radius-sm, 0.5rem)",
|
|
262
|
+
md: "var(--sv-radius-md, 0.75rem)",
|
|
263
|
+
lg: "var(--sv-radius-lg, 1rem)",
|
|
264
|
+
xl: "var(--sv-radius-xl, 1.25rem)"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
268
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
269
|
+
0 && (module.exports = {
|
|
270
|
+
Alert,
|
|
271
|
+
Avatar,
|
|
272
|
+
Badge,
|
|
273
|
+
Button,
|
|
274
|
+
Card,
|
|
275
|
+
Checkbox,
|
|
276
|
+
Input,
|
|
277
|
+
Select,
|
|
278
|
+
Skeleton,
|
|
279
|
+
Tabs,
|
|
280
|
+
Textarea,
|
|
281
|
+
cx,
|
|
282
|
+
themeTokens
|
|
283
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './components/alert';
|
|
2
|
+
export * from './components/avatar';
|
|
3
|
+
export * from './components/badge';
|
|
4
|
+
export * from './components/button';
|
|
5
|
+
export * from './components/card';
|
|
6
|
+
export * from './components/checkbox';
|
|
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';
|
|
12
|
+
export * from './tokens';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
|
|
51
|
+
// src/components/badge.tsx
|
|
52
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
53
|
+
var variants = {
|
|
54
|
+
primary: "bg-violet-500/20 text-violet-200 ring-1 ring-violet-400/20",
|
|
55
|
+
secondary: "bg-cyan-500/15 text-cyan-200 ring-1 ring-cyan-400/20",
|
|
56
|
+
outline: "bg-transparent text-slate-200 ring-1 ring-white/10"
|
|
57
|
+
};
|
|
58
|
+
function Badge({ variant = "primary", className = "", ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx3(
|
|
60
|
+
"span",
|
|
61
|
+
{
|
|
62
|
+
...props,
|
|
63
|
+
className: ["inline-flex items-center rounded-full px-2.5 py-1 text-xs font-medium", variants[variant], className].join(" ")
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/components/button.tsx
|
|
69
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
70
|
+
var variantClasses2 = {
|
|
71
|
+
primary: "bg-violet-500 text-white hover:bg-violet-400",
|
|
72
|
+
secondary: "bg-cyan-500 text-slate-950 hover:bg-cyan-400",
|
|
73
|
+
ghost: "bg-white/5 text-white hover:bg-white/10",
|
|
74
|
+
outline: "border border-white/15 bg-transparent text-white hover:bg-white/5"
|
|
75
|
+
};
|
|
76
|
+
var sizeClasses2 = {
|
|
77
|
+
sm: "px-3 py-1.5 text-sm",
|
|
78
|
+
md: "px-4 py-2 text-sm",
|
|
79
|
+
lg: "px-5 py-3 text-base"
|
|
80
|
+
};
|
|
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 });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/components/card.tsx
|
|
98
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
99
|
+
function Card({ as: Component = "div", className = "", ...props }) {
|
|
100
|
+
return /* @__PURE__ */ jsx5(
|
|
101
|
+
Component,
|
|
102
|
+
{
|
|
103
|
+
...props,
|
|
104
|
+
className: [
|
|
105
|
+
"rounded-2xl border border-white/10 bg-slate-950/50 p-4 shadow-lg shadow-slate-950/20 backdrop-blur-sm",
|
|
106
|
+
className
|
|
107
|
+
].join(" ")
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
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
|
+
|
|
125
|
+
// src/components/input.tsx
|
|
126
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
127
|
+
function Input({ className = "", ...props }) {
|
|
128
|
+
return /* @__PURE__ */ jsx7(
|
|
129
|
+
"input",
|
|
130
|
+
{
|
|
131
|
+
...props,
|
|
132
|
+
className: [
|
|
133
|
+
"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",
|
|
134
|
+
className
|
|
135
|
+
].join(" ")
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
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
|
+
|
|
215
|
+
// src/tokens/index.ts
|
|
216
|
+
var themeTokens = {
|
|
217
|
+
colors: {
|
|
218
|
+
primary: "var(--sv-primary, 139 92 246)",
|
|
219
|
+
background: "var(--sv-background, 15 23 42)",
|
|
220
|
+
foreground: "var(--sv-foreground, 248 250 252)",
|
|
221
|
+
accent: "var(--sv-accent, 34 211 238)"
|
|
222
|
+
},
|
|
223
|
+
radius: {
|
|
224
|
+
sm: "var(--sv-radius-sm, 0.5rem)",
|
|
225
|
+
md: "var(--sv-radius-md, 0.75rem)",
|
|
226
|
+
lg: "var(--sv-radius-lg, 1rem)",
|
|
227
|
+
xl: "var(--sv-radius-xl, 1.25rem)"
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
231
|
+
export {
|
|
232
|
+
Alert,
|
|
233
|
+
Avatar,
|
|
234
|
+
Badge,
|
|
235
|
+
Button,
|
|
236
|
+
Card,
|
|
237
|
+
Checkbox,
|
|
238
|
+
Input,
|
|
239
|
+
Select,
|
|
240
|
+
Skeleton,
|
|
241
|
+
Tabs,
|
|
242
|
+
Textarea,
|
|
243
|
+
cx,
|
|
244
|
+
themeTokens
|
|
245
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const themeTokens: {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: string;
|
|
4
|
+
background: string;
|
|
5
|
+
foreground: string;
|
|
6
|
+
accent: string;
|
|
7
|
+
};
|
|
8
|
+
radius: {
|
|
9
|
+
sm: string;
|
|
10
|
+
md: string;
|
|
11
|
+
lg: string;
|
|
12
|
+
xl: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const cx: (...classes: Array<string | false | undefined | null>) => string;
|
|
16
|
+
export { cx };
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackvibe-studio/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Core React component library for StackVibe UI.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/StackVibe-Studio/stackvibe-ui.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://stackvibe-studio.github.io/stackvibe-ui/",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/StackVibe-Studio/stackvibe-ui/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": ">=18.0.0",
|
|
35
|
+
"react-dom": ">=18.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/react": "^19.0.0",
|
|
39
|
+
"@types/react-dom": "^19.0.0",
|
|
40
|
+
"tsup": "^8.1.0",
|
|
41
|
+
"typescript": "^5.7.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup src/index.ts --format esm,cjs --clean && tsc --project tsconfig.json --emitDeclarationOnly",
|
|
45
|
+
"typecheck": "tsc --noEmit"
|
|
46
|
+
}
|
|
6
47
|
}
|