@helloleo/plugins 0.1.19 → 0.1.20-beta.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/dist/index.js +6 -2
- package/dist/templates/tanstack-start-2026-06-18/components.json +22 -0
- package/dist/templates/tanstack-start-2026-06-18/drizzle.config.ts +20 -0
- package/dist/templates/tanstack-start-2026-06-18/package.json +103 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/accordion.tsx +51 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/alert-dialog.tsx +115 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/alert.tsx +49 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/aspect-ratio.tsx +5 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/avatar.tsx +47 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/badge.tsx +32 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/breadcrumb.tsx +101 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/button.tsx +49 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/calendar.tsx +177 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/card.tsx +55 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/carousel.tsx +240 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/chart.tsx +331 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/checkbox.tsx +26 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/collapsible.tsx +11 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/command.tsx +143 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/context-menu.tsx +187 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/dialog.tsx +104 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/drawer.tsx +98 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/dropdown-menu.tsx +188 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/form.tsx +171 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/hover-card.tsx +27 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/input-otp.tsx +69 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/input.tsx +22 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/label.tsx +21 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/menubar.tsx +229 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/navigation-menu.tsx +120 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/pagination.tsx +98 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/popover.tsx +31 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/progress.tsx +25 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/radio-group.tsx +36 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/resizable.tsx +37 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/scroll-area.tsx +44 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/select.tsx +152 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/separator.tsx +24 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sheet.tsx +122 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sidebar.tsx +744 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/skeleton.tsx +7 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/slider.tsx +23 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sonner.tsx +23 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/switch.tsx +27 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/table.tsx +94 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/tabs.tsx +53 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/textarea.tsx +21 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/toggle-group.tsx +57 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/toggle.tsx +42 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/tooltip.tsx +32 -0
- package/dist/templates/tanstack-start-2026-06-18/src/db/index.ts +9 -0
- package/dist/templates/tanstack-start-2026-06-18/src/db/schema.ts +18 -0
- package/dist/templates/tanstack-start-2026-06-18/src/global.d.ts +3 -0
- package/dist/templates/tanstack-start-2026-06-18/src/hooks/use-mobile.tsx +19 -0
- package/dist/templates/tanstack-start-2026-06-18/src/lib/proxy.ts +83 -0
- package/dist/templates/tanstack-start-2026-06-18/src/lib/utils.ts +6 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routeTree.gen.ts +59 -0
- package/dist/templates/tanstack-start-2026-06-18/src/router.tsx +33 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routes/__root.tsx +59 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routes/index.tsx +33 -0
- package/dist/templates/tanstack-start-2026-06-18/src/server.ts +31 -0
- package/dist/templates/tanstack-start-2026-06-18/src/styles.css +214 -0
- package/dist/templates/tanstack-start-2026-06-18/tsconfig.json +27 -0
- package/dist/templates/tanstack-start-2026-06-18/vite.config.ts +17 -0
- package/dist/templates/tanstack-start-2026-06-18/wrangler.jsonc +27 -0
- package/package.json +1 -1
- package/src/templates/tanstack-start-2026-06-18/components.json +22 -0
- package/src/templates/tanstack-start-2026-06-18/drizzle.config.ts +20 -0
- package/src/templates/tanstack-start-2026-06-18/package.json +103 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/accordion.tsx +51 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/alert-dialog.tsx +115 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/alert.tsx +49 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/avatar.tsx +47 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/badge.tsx +32 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/breadcrumb.tsx +101 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/button.tsx +49 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/calendar.tsx +177 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/card.tsx +55 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/carousel.tsx +240 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/chart.tsx +331 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/checkbox.tsx +26 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/collapsible.tsx +11 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/command.tsx +143 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/context-menu.tsx +187 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/dialog.tsx +104 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/drawer.tsx +98 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/dropdown-menu.tsx +188 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/form.tsx +171 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/hover-card.tsx +27 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/input-otp.tsx +69 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/input.tsx +22 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/label.tsx +21 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/menubar.tsx +229 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/navigation-menu.tsx +120 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/pagination.tsx +98 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/popover.tsx +31 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/progress.tsx +25 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/radio-group.tsx +36 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/resizable.tsx +37 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/scroll-area.tsx +44 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/select.tsx +152 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/separator.tsx +24 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/sheet.tsx +122 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/sidebar.tsx +744 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/skeleton.tsx +7 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/slider.tsx +23 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/sonner.tsx +23 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/switch.tsx +27 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/table.tsx +94 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/tabs.tsx +53 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/textarea.tsx +21 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/toggle-group.tsx +57 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/toggle.tsx +42 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/tooltip.tsx +32 -0
- package/src/templates/tanstack-start-2026-06-18/src/db/index.ts +9 -0
- package/src/templates/tanstack-start-2026-06-18/src/db/schema.ts +18 -0
- package/src/templates/tanstack-start-2026-06-18/src/global.d.ts +3 -0
- package/src/templates/tanstack-start-2026-06-18/src/hooks/use-mobile.tsx +19 -0
- package/src/templates/tanstack-start-2026-06-18/src/lib/proxy.ts +83 -0
- package/src/templates/tanstack-start-2026-06-18/src/lib/utils.ts +6 -0
- package/src/templates/tanstack-start-2026-06-18/src/routeTree.gen.ts +59 -0
- package/src/templates/tanstack-start-2026-06-18/src/router.tsx +33 -0
- package/src/templates/tanstack-start-2026-06-18/src/routes/__root.tsx +59 -0
- package/src/templates/tanstack-start-2026-06-18/src/routes/index.tsx +33 -0
- package/src/templates/tanstack-start-2026-06-18/src/server.ts +31 -0
- package/src/templates/tanstack-start-2026-06-18/src/styles.css +214 -0
- package/src/templates/tanstack-start-2026-06-18/tsconfig.json +27 -0
- package/src/templates/tanstack-start-2026-06-18/vite.config.ts +17 -0
- package/src/templates/tanstack-start-2026-06-18/wrangler.jsonc +27 -0
- package/src/tools/scaffold.ts +20 -12
package/dist/index.js
CHANGED
|
@@ -12566,7 +12566,7 @@ async function renderTemplate(templateId, vars, destDir) {
|
|
|
12566
12566
|
}
|
|
12567
12567
|
|
|
12568
12568
|
// src/tools/scaffold.ts
|
|
12569
|
-
var SCAFFOLD_VERSION = "tanstack-
|
|
12569
|
+
var SCAFFOLD_VERSION = "tanstack-start-2026-06-18";
|
|
12570
12570
|
function projectUuidFromDir(dir) {
|
|
12571
12571
|
return path3.basename(dir);
|
|
12572
12572
|
}
|
|
@@ -12579,7 +12579,7 @@ async function writeBaseScaffold(opts, dir) {
|
|
|
12579
12579
|
return [...created, leoPath];
|
|
12580
12580
|
}
|
|
12581
12581
|
var scaffold = tool({
|
|
12582
|
-
description: "Scaffold a new React 19 + Vite + Tailwind CSS v4 + TanStack
|
|
12582
|
+
description: "Scaffold a new React 19 + Vite + Tailwind CSS v4 + TanStack Start project " + "with shadcn/ui baked in, wired to @helloleo/runtime for Cloudflare " + "bindings (D1 + KV + R2). Renders the full template: TanStack file-based " + "routing + SSR (src/routes/, src/router.tsx), the Cloudflare Worker entry " + "(src/server.ts) + wrangler.jsonc (DB/KV/BUCKET bindings), a Drizzle DB " + "layer (src/db/schema.ts as the single source of truth, src/db/index.ts " + "typed client, drizzle.config.ts), the complete shadcn/ui component set " + "under src/components/ui, src/lib/utils.ts (cn helper), src/lib/proxy.ts " + "(HelloLeo integration proxy), src/styles.css (shadcn design tokens, " + "light+dark), plus package.json, vite.config.ts, tsconfig.json, " + "components.json, .gitignore and the generated src/routeTree.gen.ts. Call " + "this FIRST for any new project before adding routes and pages. For " + "NetSuite projects (NetSuite MCP in the live list), call `setup_netsuite` " + "INSTEAD -- it bundles base scaffold + OAuth wiring in one call. Do not " + "call both.",
|
|
12583
12583
|
args: {
|
|
12584
12584
|
name: tool.schema.string().optional().describe("Project name for package.json (default: leo-project)")
|
|
12585
12585
|
},
|
|
@@ -12594,6 +12594,10 @@ var scaffold = tool({
|
|
|
12594
12594
|
"UI: shadcn/ui components are already in src/components/ui -- import and",
|
|
12595
12595
|
" use them; do not attempt to re-add via the shadcn CLI.",
|
|
12596
12596
|
"Design system: edit tokens in src/styles.css (light + dark blocks).",
|
|
12597
|
+
"Database: edit src/db/schema.ts (the single source of truth) -- `bun run",
|
|
12598
|
+
" db:push` syncs it to the dev DB; the `dev` script does this for you.",
|
|
12599
|
+
" Query via `import { db } from '#/db'` inside loaders/server functions.",
|
|
12600
|
+
" KV + R2: `import { kv, storage } from '@helloleo/runtime'`.",
|
|
12597
12601
|
"Data fetching: React Query is wired (QueryClient on the router context +",
|
|
12598
12602
|
" QueryClientProvider). ALWAYS fetch with @tanstack/react-query --",
|
|
12599
12603
|
" useQuery / useMutation in components, or a route loader calling",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"css": "src/styles.css",
|
|
8
|
+
"baseColor": "slate",
|
|
9
|
+
"cssVariables": true,
|
|
10
|
+
"prefix": ""
|
|
11
|
+
},
|
|
12
|
+
"iconLibrary": "lucide",
|
|
13
|
+
"rtl": false,
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from 'drizzle-kit'
|
|
2
|
+
|
|
3
|
+
// src/db/schema.ts is the single source of truth for the D1 / libsql schema.
|
|
4
|
+
//
|
|
5
|
+
// DEV: `drizzle-kit push --force` (the `dev` script) syncs the schema straight
|
|
6
|
+
// into the cf-shim's libsql file. The url MUST match the shim's DEV_DB_PATH
|
|
7
|
+
// default (.dev.db) so push and the running app open the same file.
|
|
8
|
+
//
|
|
9
|
+
// PROD: migrations are generated with `drizzle-kit generate` and applied to D1
|
|
10
|
+
// with `wrangler d1 migrations apply DB --remote` (reads migrations_dir in
|
|
11
|
+
// wrangler.jsonc) — so no d1-http driver or Cloudflare API env vars are needed
|
|
12
|
+
// here.
|
|
13
|
+
const devDbPath = process.env.DEV_DB_PATH ?? '.dev.db'
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
dialect: 'sqlite',
|
|
17
|
+
schema: './src/db/schema.ts',
|
|
18
|
+
out: './drizzle',
|
|
19
|
+
dbCredentials: { url: `file:${devDbPath}` },
|
|
20
|
+
})
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{LEO_NAME}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"imports": {
|
|
6
|
+
"#/*": "./src/*"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "drizzle-kit push --force && vite dev",
|
|
10
|
+
"build": "oxlint --fix && vite build",
|
|
11
|
+
"preview": "vite preview",
|
|
12
|
+
"deploy": "bun run db:generate && vite build && wrangler deploy && wrangler d1 migrations apply DB --remote",
|
|
13
|
+
"db:generate": "drizzle-kit generate",
|
|
14
|
+
"db:push": "drizzle-kit push --force",
|
|
15
|
+
"db:migrate": "wrangler d1 migrations apply DB --remote",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"lint": "oxlint --fix",
|
|
18
|
+
"test": "vitest run"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@helloleo/runtime": "^0.1.1",
|
|
22
|
+
"@hookform/resolvers": "^5.2.2",
|
|
23
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
24
|
+
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
25
|
+
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
|
26
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
27
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
28
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
29
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
30
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
31
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
32
|
+
"@radix-ui/react-hover-card": "^1.1.15",
|
|
33
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
34
|
+
"@radix-ui/react-menubar": "^1.1.16",
|
|
35
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
36
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
37
|
+
"@radix-ui/react-progress": "^1.1.8",
|
|
38
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
39
|
+
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
40
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
41
|
+
"@radix-ui/react-separator": "^1.1.8",
|
|
42
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
43
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
44
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
45
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
46
|
+
"@radix-ui/react-toggle": "^1.1.10",
|
|
47
|
+
"@radix-ui/react-toggle-group": "^1.1.11",
|
|
48
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
49
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
50
|
+
"@tanstack/react-query": "^5.90.0",
|
|
51
|
+
"@tanstack/react-router": "latest",
|
|
52
|
+
"@tanstack/react-router-with-query": "latest",
|
|
53
|
+
"@tanstack/react-start": "latest",
|
|
54
|
+
"class-variance-authority": "^0.7.1",
|
|
55
|
+
"clsx": "^2.1.1",
|
|
56
|
+
"cmdk": "^1.1.1",
|
|
57
|
+
"date-fns": "^4.1.0",
|
|
58
|
+
"drizzle-orm": "^0.45.2",
|
|
59
|
+
"embla-carousel-react": "^8.6.0",
|
|
60
|
+
"input-otp": "^1.4.2",
|
|
61
|
+
"lucide-react": "^0.575.0",
|
|
62
|
+
"react": "^19.2.0",
|
|
63
|
+
"react-day-picker": "^9.14.0",
|
|
64
|
+
"react-dom": "^19.2.0",
|
|
65
|
+
"react-hook-form": "^7.71.2",
|
|
66
|
+
"react-resizable-panels": "^4.6.5",
|
|
67
|
+
"recharts": "^2.15.4",
|
|
68
|
+
"sonner": "^2.0.7",
|
|
69
|
+
"tailwind-merge": "^3.5.0",
|
|
70
|
+
"tailwindcss": "^4.1.18",
|
|
71
|
+
"tw-animate-css": "^1.3.4",
|
|
72
|
+
"vaul": "^1.1.2",
|
|
73
|
+
"zod": "^3.24.2"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@cloudflare/vite-plugin": "^1.13.0",
|
|
77
|
+
"@cloudflare/workers-types": "^4.20250906.0",
|
|
78
|
+
"@helloleo/vite-config": "^0.1.2",
|
|
79
|
+
"@libsql/client": "^0.14.0",
|
|
80
|
+
"@tailwindcss/typography": "^0.5.16",
|
|
81
|
+
"drizzle-kit": "^0.31.10",
|
|
82
|
+
"@tanstack/router-plugin": "latest",
|
|
83
|
+
"@testing-library/dom": "^10.4.1",
|
|
84
|
+
"@testing-library/react": "^16.3.0",
|
|
85
|
+
"@types/node": "^22.10.2",
|
|
86
|
+
"@types/react": "^19.2.0",
|
|
87
|
+
"@types/react-dom": "^19.2.0",
|
|
88
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
89
|
+
"jsdom": "^28.1.0",
|
|
90
|
+
"oxlint": "^1.69.0",
|
|
91
|
+
"typescript": "^6.0.2",
|
|
92
|
+
"vite": "^8.0.0",
|
|
93
|
+
"vite-tsconfig-paths": "^6.0.0",
|
|
94
|
+
"vitest": "^4.1.5",
|
|
95
|
+
"wrangler": "^4.70.0"
|
|
96
|
+
},
|
|
97
|
+
"pnpm": {
|
|
98
|
+
"onlyBuiltDependencies": [
|
|
99
|
+
"esbuild",
|
|
100
|
+
"lightningcss"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const Accordion = AccordionPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const AccordionItem = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<AccordionPrimitive.Item ref={ref} className={cn("border-b", className)} {...props} />
|
|
14
|
+
));
|
|
15
|
+
AccordionItem.displayName = "AccordionItem";
|
|
16
|
+
|
|
17
|
+
const AccordionTrigger = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
20
|
+
>(({ className, children, ...props }, ref) => (
|
|
21
|
+
<AccordionPrimitive.Header className="flex">
|
|
22
|
+
<AccordionPrimitive.Trigger
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex flex-1 items-center justify-between py-4 text-sm font-medium cursor-pointer transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
|
|
32
|
+
</AccordionPrimitive.Trigger>
|
|
33
|
+
</AccordionPrimitive.Header>
|
|
34
|
+
));
|
|
35
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
36
|
+
|
|
37
|
+
const AccordionContent = React.forwardRef<
|
|
38
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
40
|
+
>(({ className, children, ...props }, ref) => (
|
|
41
|
+
<AccordionPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
<div className={cn("pb-4 pt-0", className)}>{children}</div>
|
|
47
|
+
</AccordionPrimitive.Content>
|
|
48
|
+
));
|
|
49
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
50
|
+
|
|
51
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
6
|
+
|
|
7
|
+
const AlertDialog = AlertDialogPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
10
|
+
|
|
11
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
12
|
+
|
|
13
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
16
|
+
>(({ className, ...props }, ref) => (
|
|
17
|
+
<AlertDialogPrimitive.Overlay
|
|
18
|
+
className={cn(
|
|
19
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
ref={ref}
|
|
24
|
+
/>
|
|
25
|
+
));
|
|
26
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
27
|
+
|
|
28
|
+
const AlertDialogContent = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<AlertDialogPortal>
|
|
33
|
+
<AlertDialogOverlay />
|
|
34
|
+
<AlertDialogPrimitive.Content
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(
|
|
37
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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 sm:rounded-lg",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
</AlertDialogPortal>
|
|
43
|
+
));
|
|
44
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
45
|
+
|
|
46
|
+
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
47
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
48
|
+
);
|
|
49
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
50
|
+
|
|
51
|
+
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
52
|
+
<div
|
|
53
|
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
58
|
+
|
|
59
|
+
const AlertDialogTitle = React.forwardRef<
|
|
60
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
61
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
62
|
+
>(({ className, ...props }, ref) => (
|
|
63
|
+
<AlertDialogPrimitive.Title
|
|
64
|
+
ref={ref}
|
|
65
|
+
className={cn("text-lg font-semibold", className)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
));
|
|
69
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
70
|
+
|
|
71
|
+
const AlertDialogDescription = React.forwardRef<
|
|
72
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
73
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
74
|
+
>(({ className, ...props }, ref) => (
|
|
75
|
+
<AlertDialogPrimitive.Description
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
));
|
|
81
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
82
|
+
|
|
83
|
+
const AlertDialogAction = React.forwardRef<
|
|
84
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
85
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
86
|
+
>(({ className, ...props }, ref) => (
|
|
87
|
+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
88
|
+
));
|
|
89
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
90
|
+
|
|
91
|
+
const AlertDialogCancel = React.forwardRef<
|
|
92
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
93
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
94
|
+
>(({ className, ...props }, ref) => (
|
|
95
|
+
<AlertDialogPrimitive.Cancel
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
));
|
|
101
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
AlertDialog,
|
|
105
|
+
AlertDialogPortal,
|
|
106
|
+
AlertDialogOverlay,
|
|
107
|
+
AlertDialogTrigger,
|
|
108
|
+
AlertDialogContent,
|
|
109
|
+
AlertDialogHeader,
|
|
110
|
+
AlertDialogFooter,
|
|
111
|
+
AlertDialogTitle,
|
|
112
|
+
AlertDialogDescription,
|
|
113
|
+
AlertDialogAction,
|
|
114
|
+
AlertDialogCancel,
|
|
115
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-background text-foreground",
|
|
12
|
+
destructive:
|
|
13
|
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const Alert = React.forwardRef<
|
|
23
|
+
HTMLDivElement,
|
|
24
|
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
25
|
+
>(({ className, variant, ...props }, ref) => (
|
|
26
|
+
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
|
|
27
|
+
));
|
|
28
|
+
Alert.displayName = "Alert";
|
|
29
|
+
|
|
30
|
+
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
31
|
+
({ className, ...props }, ref) => (
|
|
32
|
+
<h5
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
AlertTitle.displayName = "AlertTitle";
|
|
40
|
+
|
|
41
|
+
const AlertDescription = React.forwardRef<
|
|
42
|
+
HTMLParagraphElement,
|
|
43
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
44
|
+
>(({ className, ...props }, ref) => (
|
|
45
|
+
<div ref={ref} className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
|
|
46
|
+
));
|
|
47
|
+
AlertDescription.displayName = "AlertDescription";
|
|
48
|
+
|
|
49
|
+
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
const Avatar = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<AvatarPrimitive.Root
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
));
|
|
18
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
19
|
+
|
|
20
|
+
const AvatarImage = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<AvatarPrimitive.Image
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn("aspect-square h-full w-full", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
31
|
+
|
|
32
|
+
const AvatarFallback = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<AvatarPrimitive.Fallback
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
));
|
|
45
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
46
|
+
|
|
47
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 badgeVariants = cva(
|
|
7
|
+
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
|
12
|
+
secondary:
|
|
13
|
+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
14
|
+
destructive:
|
|
15
|
+
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
|
|
16
|
+
outline: "text-foreground",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "default",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export interface BadgeProps
|
|
26
|
+
extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
|
27
|
+
|
|
28
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
29
|
+
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const Breadcrumb = React.forwardRef<
|
|
8
|
+
HTMLElement,
|
|
9
|
+
React.ComponentPropsWithoutRef<"nav"> & {
|
|
10
|
+
separator?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
|
|
13
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
14
|
+
|
|
15
|
+
const BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<"ol">>(
|
|
16
|
+
({ className, ...props }, ref) => (
|
|
17
|
+
<ol
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
28
|
+
|
|
29
|
+
const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<"li">>(
|
|
30
|
+
({ className, ...props }, ref) => (
|
|
31
|
+
<li ref={ref} className={cn("inline-flex items-center gap-1.5", className)} {...props} />
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
35
|
+
|
|
36
|
+
const BreadcrumbLink = React.forwardRef<
|
|
37
|
+
HTMLAnchorElement,
|
|
38
|
+
React.ComponentPropsWithoutRef<"a"> & {
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
}
|
|
41
|
+
>(({ asChild, className, ...props }, ref) => {
|
|
42
|
+
const Comp = asChild ? Slot : "a";
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Comp
|
|
46
|
+
ref={ref}
|
|
47
|
+
className={cn("transition-colors hover:text-foreground", className)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
53
|
+
|
|
54
|
+
const BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<"span">>(
|
|
55
|
+
({ className, ...props }, ref) => (
|
|
56
|
+
<span
|
|
57
|
+
ref={ref}
|
|
58
|
+
role="link"
|
|
59
|
+
aria-disabled="true"
|
|
60
|
+
aria-current="page"
|
|
61
|
+
className={cn("font-normal text-foreground", className)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
67
|
+
|
|
68
|
+
const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<"li">) => (
|
|
69
|
+
<li
|
|
70
|
+
role="presentation"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
{children ?? <ChevronRight />}
|
|
76
|
+
</li>
|
|
77
|
+
);
|
|
78
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
79
|
+
|
|
80
|
+
const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
|
|
81
|
+
<span
|
|
82
|
+
role="presentation"
|
|
83
|
+
aria-hidden="true"
|
|
84
|
+
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
|
85
|
+
{...props}
|
|
86
|
+
>
|
|
87
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
88
|
+
<span className="sr-only">More</span>
|
|
89
|
+
</span>
|
|
90
|
+
);
|
|
91
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
Breadcrumb,
|
|
95
|
+
BreadcrumbList,
|
|
96
|
+
BreadcrumbItem,
|
|
97
|
+
BreadcrumbLink,
|
|
98
|
+
BreadcrumbPage,
|
|
99
|
+
BreadcrumbSeparator,
|
|
100
|
+
BreadcrumbEllipsis,
|
|
101
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
13
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
14
|
+
outline:
|
|
15
|
+
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
17
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
18
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: "h-9 px-4 py-2",
|
|
22
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
23
|
+
lg: "h-10 rounded-md px-8",
|
|
24
|
+
icon: "h-9 w-9",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: "default",
|
|
29
|
+
size: "default",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export interface ButtonProps
|
|
35
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
41
|
+
const Comp = asChild ? Slot : "button";
|
|
42
|
+
return (
|
|
43
|
+
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
Button.displayName = "Button";
|
|
48
|
+
|
|
49
|
+
export { Button, buttonVariants };
|