seven-design-ui 0.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/.eslintrc.json +35 -0
- package/.prettierrc.json +10 -0
- package/CONTRIBUTING.md +350 -0
- package/PROJECT_STRUCTURE.md +343 -0
- package/README.md +83 -0
- package/app/globals.css +125 -0
- package/app/layout.tsx +45 -0
- package/app/page.tsx +202 -0
- package/components/theme-provider.tsx +11 -0
- package/components/ui/accordion.tsx +66 -0
- package/components/ui/alert-dialog.tsx +157 -0
- package/components/ui/alert.tsx +66 -0
- package/components/ui/aspect-ratio.tsx +11 -0
- package/components/ui/avatar.tsx +53 -0
- package/components/ui/badge.tsx +46 -0
- package/components/ui/breadcrumb.tsx +109 -0
- package/components/ui/button-group.tsx +83 -0
- package/components/ui/button.tsx +60 -0
- package/components/ui/calendar.tsx +213 -0
- package/components/ui/card.tsx +92 -0
- package/components/ui/carousel.tsx +241 -0
- package/components/ui/chart.tsx +353 -0
- package/components/ui/checkbox.tsx +32 -0
- package/components/ui/collapsible.tsx +33 -0
- package/components/ui/command.tsx +184 -0
- package/components/ui/context-menu.tsx +252 -0
- package/components/ui/dialog.tsx +143 -0
- package/components/ui/drawer.tsx +135 -0
- package/components/ui/dropdown-menu.tsx +257 -0
- package/components/ui/empty.tsx +104 -0
- package/components/ui/field.tsx +244 -0
- package/components/ui/form.tsx +167 -0
- package/components/ui/hover-card.tsx +44 -0
- package/components/ui/input-group.tsx +169 -0
- package/components/ui/input-otp.tsx +77 -0
- package/components/ui/input.tsx +21 -0
- package/components/ui/item.tsx +193 -0
- package/components/ui/kbd.tsx +28 -0
- package/components/ui/label.tsx +24 -0
- package/components/ui/menubar.tsx +276 -0
- package/components/ui/navigation-menu.tsx +166 -0
- package/components/ui/pagination.tsx +127 -0
- package/components/ui/popover.tsx +48 -0
- package/components/ui/progress.tsx +31 -0
- package/components/ui/radio-group.tsx +45 -0
- package/components/ui/resizable.tsx +56 -0
- package/components/ui/scroll-area.tsx +58 -0
- package/components/ui/select.tsx +185 -0
- package/components/ui/separator.tsx +28 -0
- package/components/ui/sheet.tsx +139 -0
- package/components/ui/sidebar.tsx +726 -0
- package/components/ui/skeleton.tsx +13 -0
- package/components/ui/slider.tsx +63 -0
- package/components/ui/sonner.tsx +25 -0
- package/components/ui/spinner.tsx +16 -0
- package/components/ui/switch.tsx +31 -0
- package/components/ui/table.tsx +116 -0
- package/components/ui/tabs.tsx +66 -0
- package/components/ui/textarea.tsx +18 -0
- package/components/ui/toast.tsx +129 -0
- package/components/ui/toaster.tsx +35 -0
- package/components/ui/toggle-group.tsx +73 -0
- package/components/ui/toggle.tsx +47 -0
- package/components/ui/tooltip.tsx +61 -0
- package/components/ui/use-mobile.tsx +19 -0
- package/components/ui/use-toast.ts +191 -0
- package/components.json +21 -0
- package/docs/components/button.mdx +155 -0
- package/docs/components/input.mdx +157 -0
- package/docs/components/pagination.mdx +186 -0
- package/docs/components/switch.mdx +134 -0
- package/docs/doc_build/.nojekyll +0 -0
- package/docs/doc_build/404.html +15 -0
- package/docs/doc_build/components/button.html +39 -0
- package/docs/doc_build/components/input.html +39 -0
- package/docs/doc_build/components/pagination.html +39 -0
- package/docs/doc_build/components/switch.html +38 -0
- package/docs/doc_build/guide/introduction.html +58 -0
- package/docs/doc_build/guide/quick-start.html +98 -0
- package/docs/doc_build/guide/theme.html +139 -0
- package/docs/doc_build/index.html +15 -0
- package/docs/doc_build/logo.svg +1 -0
- package/docs/doc_build/static/css/styles.5a3e7113.css +1 -0
- package/docs/doc_build/static/js/414.04bb58dd.js +6 -0
- package/docs/doc_build/static/js/414.04bb58dd.js.LICENSE.txt +21 -0
- package/docs/doc_build/static/js/async/166.f43be01a.js +2 -0
- package/docs/doc_build/static/js/async/166.f43be01a.js.LICENSE.txt +19 -0
- package/docs/doc_build/static/js/async/218.cd780e24.js +1 -0
- package/docs/doc_build/static/js/async/232.11414fd7.js +1 -0
- package/docs/doc_build/static/js/async/416.b217df75.js +1 -0
- package/docs/doc_build/static/js/async/509.97958e51.js +1 -0
- package/docs/doc_build/static/js/async/512.9047d21e.js +1 -0
- package/docs/doc_build/static/js/async/531.131f5963.js +1 -0
- package/docs/doc_build/static/js/async/562.b402b94f.js +2 -0
- package/docs/doc_build/static/js/async/562.b402b94f.js.LICENSE.txt +11 -0
- package/docs/doc_build/static/js/async/637.cb5d76c9.js +1 -0
- package/docs/doc_build/static/js/async/712.558b85be.js +1 -0
- package/docs/doc_build/static/js/index.0991c749.js +1 -0
- package/docs/doc_build/static/js/lib-react.ce4199ca.js +2 -0
- package/docs/doc_build/static/js/lib-react.ce4199ca.js.LICENSE.txt +49 -0
- package/docs/doc_build/static/js/lib-router.4000fe55.js +2 -0
- package/docs/doc_build/static/js/lib-router.4000fe55.js.LICENSE.txt +32 -0
- package/docs/doc_build/static/js/styles.f2af9a40.js +1 -0
- package/docs/doc_build/static/search_index.72c9c372.json +1 -0
- package/docs/docs/public/logo.svg +1 -0
- package/docs/guide/introduction.md +50 -0
- package/docs/guide/quick-start.md +132 -0
- package/docs/guide/theme.md +230 -0
- package/docs/index.md +85 -0
- package/docs/package.json +22 -0
- package/docs/public/logo.svg +1 -0
- package/docs/rspress.config.ts +116 -0
- package/hooks/use-mobile.ts +19 -0
- package/hooks/use-toast.ts +191 -0
- package/next.config.mjs +11 -0
- package/package.json +75 -0
- package/packages/components/package.json +34 -0
- package/packages/components/src/button/Button.tsx +83 -0
- package/packages/components/src/button/button.css +256 -0
- package/packages/components/src/button/index.ts +2 -0
- package/packages/components/src/index.ts +8 -0
- package/packages/components/src/input/Input.tsx +230 -0
- package/packages/components/src/input/index.ts +2 -0
- package/packages/components/src/input/input.css +99 -0
- package/packages/components/src/pagination/Pagination.tsx +271 -0
- package/packages/components/src/pagination/index.ts +1 -0
- package/packages/components/src/pagination/pagination.css +225 -0
- package/packages/components/src/switch/Switch.tsx +145 -0
- package/packages/components/src/switch/index.ts +2 -0
- package/packages/components/src/switch/switch.css +119 -0
- package/packages/components/tsconfig.json +12 -0
- package/packages/components/vite.config.ts +31 -0
- package/packages/core/package.json +23 -0
- package/packages/core/src/hooks/useControllableState.ts +31 -0
- package/packages/core/src/hooks/useEventListener.ts +37 -0
- package/packages/core/src/index.ts +7 -0
- package/packages/core/src/utils/classnames.ts +48 -0
- package/packages/core/tsconfig.json +12 -0
- package/packages/core/vite.config.ts +24 -0
- package/packages/theme/package.json +20 -0
- package/packages/theme/src/index.css +138 -0
- package/packages/theme/src/index.ts +1 -0
- package/packages/theme/vite.config.ts +21 -0
- package/play/index.html +13 -0
- package/play/package.json +25 -0
- package/play/src/App.tsx +237 -0
- package/play/src/index.css +93 -0
- package/play/src/main.tsx +14 -0
- package/play/tsconfig.json +8 -0
- package/play/vite.config.ts +10 -0
- package/pnpm-workspace.yaml +4 -0
- package/postcss.config.mjs +8 -0
- package/public/logo.svg +1 -0
- package/scripts/build.sh +19 -0
- package/scripts/deploy-docs.js +38 -0
- package/styles/globals.css +125 -0
- package/tsconfig.json +30 -0
package/app/page.tsx
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { Button } from '../packages/components/src/button/Button'
|
|
5
|
+
import { Input } from '../packages/components/src/input/Input'
|
|
6
|
+
import { Switch } from '../packages/components/src/switch/Switch'
|
|
7
|
+
import '../packages/theme/src/index.css'
|
|
8
|
+
|
|
9
|
+
export default function Page() {
|
|
10
|
+
const [inputValue, setInputValue] = useState('')
|
|
11
|
+
const [switchChecked, setSwitchChecked] = useState(false)
|
|
12
|
+
const [loading, setLoading] = useState(false)
|
|
13
|
+
|
|
14
|
+
const handleClick = () => {
|
|
15
|
+
setLoading(true)
|
|
16
|
+
setTimeout(() => setLoading(false), 2000)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
|
|
21
|
+
{/* Hero Section */}
|
|
22
|
+
<div className="container mx-auto px-4 py-16">
|
|
23
|
+
<div className="text-center mb-16">
|
|
24
|
+
<h1 className="text-6xl font-bold text-gray-900 mb-4">
|
|
25
|
+
SevenDesign
|
|
26
|
+
</h1>
|
|
27
|
+
<p className="text-xl text-gray-600 mb-8">
|
|
28
|
+
企业级 React UI 组件库
|
|
29
|
+
</p>
|
|
30
|
+
<p className="text-lg text-gray-500 max-w-2xl mx-auto mb-8">
|
|
31
|
+
现代化、可定制、TypeScript 驱动的组件库。基于 Monorepo 架构,提供完整的开发工具链和文档体系。
|
|
32
|
+
</p>
|
|
33
|
+
<div className="flex gap-4 justify-center flex-wrap">
|
|
34
|
+
<Button type="primary" size="large">
|
|
35
|
+
快速开始
|
|
36
|
+
</Button>
|
|
37
|
+
<Button size="large" plain>
|
|
38
|
+
查看文档
|
|
39
|
+
</Button>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
{/* Features */}
|
|
44
|
+
<div className="grid md:grid-cols-3 gap-8 mb-16">
|
|
45
|
+
<div className="bg-white rounded-xl p-6 shadow-lg">
|
|
46
|
+
<div className="text-4xl mb-4">🎨</div>
|
|
47
|
+
<h3 className="text-xl font-semibold mb-2">精美设计</h3>
|
|
48
|
+
<p className="text-gray-600">
|
|
49
|
+
现代化的设计风格,参考 Element Plus,提供优雅的用户体验
|
|
50
|
+
</p>
|
|
51
|
+
</div>
|
|
52
|
+
<div className="bg-white rounded-xl p-6 shadow-lg">
|
|
53
|
+
<div className="text-4xl mb-4">🔧</div>
|
|
54
|
+
<h3 className="text-xl font-semibold mb-2">TypeScript</h3>
|
|
55
|
+
<p className="text-gray-600">
|
|
56
|
+
完整的类型定义,提供更好的开发体验和代码提示
|
|
57
|
+
</p>
|
|
58
|
+
</div>
|
|
59
|
+
<div className="bg-white rounded-xl p-6 shadow-lg">
|
|
60
|
+
<div className="text-4xl mb-4">🎭</div>
|
|
61
|
+
<h3 className="text-xl font-semibold mb-2">主题定制</h3>
|
|
62
|
+
<p className="text-gray-600">
|
|
63
|
+
基于 CSS Variables 的主题系统,轻松定制你的品牌风格
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{/* Component Demos */}
|
|
69
|
+
<div className="bg-white rounded-2xl p-8 shadow-xl mb-8">
|
|
70
|
+
<h2 className="text-3xl font-bold text-gray-900 mb-8 text-center">
|
|
71
|
+
组件演示
|
|
72
|
+
</h2>
|
|
73
|
+
|
|
74
|
+
{/* Button Demo */}
|
|
75
|
+
<div className="mb-12">
|
|
76
|
+
<h3 className="text-2xl font-semibold mb-4 pb-2 border-b-2 border-gray-200">
|
|
77
|
+
Button 按钮
|
|
78
|
+
</h3>
|
|
79
|
+
<div className="space-y-4">
|
|
80
|
+
<div className="flex gap-3 flex-wrap">
|
|
81
|
+
<Button>默认按钮</Button>
|
|
82
|
+
<Button type="primary">主要按钮</Button>
|
|
83
|
+
<Button type="success">成功按钮</Button>
|
|
84
|
+
<Button type="warning">警告按钮</Button>
|
|
85
|
+
<Button type="danger">危险按钮</Button>
|
|
86
|
+
<Button type="info">信息按钮</Button>
|
|
87
|
+
</div>
|
|
88
|
+
<div className="flex gap-3 flex-wrap">
|
|
89
|
+
<Button plain>朴素按钮</Button>
|
|
90
|
+
<Button type="primary" plain>
|
|
91
|
+
主要按钮
|
|
92
|
+
</Button>
|
|
93
|
+
<Button type="success" plain>
|
|
94
|
+
成功按钮
|
|
95
|
+
</Button>
|
|
96
|
+
</div>
|
|
97
|
+
<div className="flex gap-3 items-center flex-wrap">
|
|
98
|
+
<Button size="large">大型按钮</Button>
|
|
99
|
+
<Button>默认按钮</Button>
|
|
100
|
+
<Button size="small">小型按钮</Button>
|
|
101
|
+
</div>
|
|
102
|
+
<div className="flex gap-3 flex-wrap">
|
|
103
|
+
<Button loading={loading} type="primary" onClick={handleClick}>
|
|
104
|
+
{loading ? '加载中...' : '点击加载'}
|
|
105
|
+
</Button>
|
|
106
|
+
<Button disabled>禁用按钮</Button>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{/* Input Demo */}
|
|
112
|
+
<div className="mb-12">
|
|
113
|
+
<h3 className="text-2xl font-semibold mb-4 pb-2 border-b-2 border-gray-200">
|
|
114
|
+
Input 输入框
|
|
115
|
+
</h3>
|
|
116
|
+
<div className="space-y-4 max-w-md">
|
|
117
|
+
<Input
|
|
118
|
+
placeholder="请输入内容"
|
|
119
|
+
value={inputValue}
|
|
120
|
+
onInput={setInputValue}
|
|
121
|
+
/>
|
|
122
|
+
<Input placeholder="可清空的输入框" clearable />
|
|
123
|
+
<Input placeholder="密码输入框" type="password" showPassword />
|
|
124
|
+
<Input placeholder="禁用状态" disabled />
|
|
125
|
+
<div className="flex gap-3">
|
|
126
|
+
<Input placeholder="大尺寸" size="large" />
|
|
127
|
+
<Input placeholder="默认" />
|
|
128
|
+
<Input placeholder="小尺寸" size="small" />
|
|
129
|
+
</div>
|
|
130
|
+
{inputValue && (
|
|
131
|
+
<div className="p-3 bg-blue-50 border-l-4 border-blue-500 rounded">
|
|
132
|
+
<p className="text-gray-700">输入的内容:{inputValue}</p>
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
{/* Switch Demo */}
|
|
139
|
+
<div>
|
|
140
|
+
<h3 className="text-2xl font-semibold mb-4 pb-2 border-b-2 border-gray-200">
|
|
141
|
+
Switch 开关
|
|
142
|
+
</h3>
|
|
143
|
+
<div className="space-y-4">
|
|
144
|
+
<div className="flex gap-4 items-center flex-wrap">
|
|
145
|
+
<Switch checked={switchChecked} onChange={setSwitchChecked} />
|
|
146
|
+
<Switch defaultChecked />
|
|
147
|
+
<Switch disabled />
|
|
148
|
+
<Switch loading />
|
|
149
|
+
</div>
|
|
150
|
+
<div className="p-3 bg-blue-50 border-l-4 border-blue-500 rounded">
|
|
151
|
+
<p className="text-gray-700">
|
|
152
|
+
当前状态:{switchChecked ? '✅ 开启' : '❌ 关闭'}
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
{/* Installation */}
|
|
160
|
+
<div className="bg-gradient-to-r from-indigo-600 to-blue-600 rounded-2xl p-8 text-white">
|
|
161
|
+
<h2 className="text-3xl font-bold mb-4 text-center">快速安装</h2>
|
|
162
|
+
<div className="max-w-2xl mx-auto">
|
|
163
|
+
<pre className="bg-black/20 rounded-lg p-4 overflow-x-auto backdrop-blur">
|
|
164
|
+
<code className="text-sm">
|
|
165
|
+
{`# npm
|
|
166
|
+
npm install seven-design-ui
|
|
167
|
+
|
|
168
|
+
# pnpm
|
|
169
|
+
pnpm add seven-design-ui
|
|
170
|
+
|
|
171
|
+
# yarn
|
|
172
|
+
yarn add seven-design-ui`}
|
|
173
|
+
</code>
|
|
174
|
+
</pre>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
{/* Footer Info */}
|
|
179
|
+
<div className="mt-16 text-center text-gray-600">
|
|
180
|
+
<p className="mb-4">
|
|
181
|
+
这是一个 Monorepo 项目演示页面。完整的开发环境包括:
|
|
182
|
+
</p>
|
|
183
|
+
<div className="flex gap-4 justify-center flex-wrap">
|
|
184
|
+
<span className="px-4 py-2 bg-white rounded-lg shadow">
|
|
185
|
+
📦 packages/ - 组件库源码
|
|
186
|
+
</span>
|
|
187
|
+
<span className="px-4 py-2 bg-white rounded-lg shadow">
|
|
188
|
+
🎮 play/ - 本地调试环境
|
|
189
|
+
</span>
|
|
190
|
+
<span className="px-4 py-2 bg-white rounded-lg shadow">
|
|
191
|
+
📚 docs/ - Rspress 文档站点
|
|
192
|
+
</span>
|
|
193
|
+
</div>
|
|
194
|
+
<p className="mt-6 text-sm">
|
|
195
|
+
运行 <code className="bg-white px-2 py-1 rounded">pnpm dev</code> 启动 Playground
|
|
196
|
+
或 <code className="bg-white px-2 py-1 rounded">pnpm docs:dev</code> 查看完整文档
|
|
197
|
+
</p>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import {
|
|
5
|
+
ThemeProvider as NextThemesProvider,
|
|
6
|
+
type ThemeProviderProps,
|
|
7
|
+
} from 'next-themes'
|
|
8
|
+
|
|
9
|
+
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
|
10
|
+
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
|
|
11
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion'
|
|
5
|
+
import { ChevronDownIcon } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
function Accordion({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
12
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AccordionItem({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
19
|
+
return (
|
|
20
|
+
<AccordionPrimitive.Item
|
|
21
|
+
data-slot="accordion-item"
|
|
22
|
+
className={cn('border-b last:border-b-0', className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function AccordionTrigger({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
33
|
+
return (
|
|
34
|
+
<AccordionPrimitive.Header className="flex">
|
|
35
|
+
<AccordionPrimitive.Trigger
|
|
36
|
+
data-slot="accordion-trigger"
|
|
37
|
+
className={cn(
|
|
38
|
+
'focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
45
|
+
</AccordionPrimitive.Trigger>
|
|
46
|
+
</AccordionPrimitive.Header>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function AccordionContent({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<AccordionPrimitive.Content
|
|
57
|
+
data-slot="accordion-content"
|
|
58
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div className={cn('pt-0 pb-4', className)}>{children}</div>
|
|
62
|
+
</AccordionPrimitive.Content>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
import { buttonVariants } from '@/components/ui/button'
|
|
8
|
+
|
|
9
|
+
function AlertDialog({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
12
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AlertDialogTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
18
|
+
return (
|
|
19
|
+
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function AlertDialogPortal({
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
26
|
+
return (
|
|
27
|
+
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function AlertDialogOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<AlertDialogPrimitive.Overlay
|
|
37
|
+
data-slot="alert-dialog-overlay"
|
|
38
|
+
className={cn(
|
|
39
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function AlertDialogContent({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
51
|
+
return (
|
|
52
|
+
<AlertDialogPortal>
|
|
53
|
+
<AlertDialogOverlay />
|
|
54
|
+
<AlertDialogPrimitive.Content
|
|
55
|
+
data-slot="alert-dialog-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
</AlertDialogPortal>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function AlertDialogHeader({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<'div'>) {
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
data-slot="alert-dialog-header"
|
|
73
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function AlertDialogFooter({
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<'div'>) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="alert-dialog-footer"
|
|
86
|
+
className={cn(
|
|
87
|
+
'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
|
|
88
|
+
className,
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function AlertDialogTitle({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
99
|
+
return (
|
|
100
|
+
<AlertDialogPrimitive.Title
|
|
101
|
+
data-slot="alert-dialog-title"
|
|
102
|
+
className={cn('text-lg font-semibold', className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function AlertDialogDescription({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
112
|
+
return (
|
|
113
|
+
<AlertDialogPrimitive.Description
|
|
114
|
+
data-slot="alert-dialog-description"
|
|
115
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function AlertDialogAction({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
125
|
+
return (
|
|
126
|
+
<AlertDialogPrimitive.Action
|
|
127
|
+
className={cn(buttonVariants(), className)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function AlertDialogCancel({
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
137
|
+
return (
|
|
138
|
+
<AlertDialogPrimitive.Cancel
|
|
139
|
+
className={cn(buttonVariants({ variant: 'outline' }), className)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
AlertDialog,
|
|
147
|
+
AlertDialogPortal,
|
|
148
|
+
AlertDialogOverlay,
|
|
149
|
+
AlertDialogTrigger,
|
|
150
|
+
AlertDialogContent,
|
|
151
|
+
AlertDialogHeader,
|
|
152
|
+
AlertDialogFooter,
|
|
153
|
+
AlertDialogTitle,
|
|
154
|
+
AlertDialogDescription,
|
|
155
|
+
AlertDialogAction,
|
|
156
|
+
AlertDialogCancel,
|
|
157
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const alertVariants = cva(
|
|
7
|
+
'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-card text-card-foreground',
|
|
12
|
+
destructive:
|
|
13
|
+
'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: 'default',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
function Alert({
|
|
23
|
+
className,
|
|
24
|
+
variant,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
data-slot="alert"
|
|
30
|
+
role="alert"
|
|
31
|
+
className={cn(alertVariants({ variant }), className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
data-slot="alert-title"
|
|
41
|
+
className={cn(
|
|
42
|
+
'col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight',
|
|
43
|
+
className,
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function AlertDescription({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<'div'>) {
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
data-slot="alert-description"
|
|
57
|
+
className={cn(
|
|
58
|
+
'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio'
|
|
4
|
+
|
|
5
|
+
function AspectRatio({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
8
|
+
return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { AspectRatio }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
function Avatar({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<AvatarPrimitive.Root
|
|
14
|
+
data-slot="avatar"
|
|
15
|
+
className={cn(
|
|
16
|
+
'relative flex size-8 shrink-0 overflow-hidden rounded-full',
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function AvatarImage({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
28
|
+
return (
|
|
29
|
+
<AvatarPrimitive.Image
|
|
30
|
+
data-slot="avatar-image"
|
|
31
|
+
className={cn('aspect-square size-full', className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function AvatarFallback({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
41
|
+
return (
|
|
42
|
+
<AvatarPrimitive.Fallback
|
|
43
|
+
data-slot="avatar-fallback"
|
|
44
|
+
className={cn(
|
|
45
|
+
'bg-muted flex size-full items-center justify-center rounded-full',
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
|
|
7
|
+
const badgeVariants = cva(
|
|
8
|
+
'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default:
|
|
13
|
+
'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
|
14
|
+
secondary:
|
|
15
|
+
'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
|
|
16
|
+
destructive:
|
|
17
|
+
'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
18
|
+
outline:
|
|
19
|
+
'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
function Badge({
|
|
29
|
+
className,
|
|
30
|
+
variant,
|
|
31
|
+
asChild = false,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<'span'> &
|
|
34
|
+
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
35
|
+
const Comp = asChild ? Slot : 'span'
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Comp
|
|
39
|
+
data-slot="badge"
|
|
40
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { Badge, badgeVariants }
|