create-sidekick-app 0.0.1 → 2.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/LICENSE.md +202 -0
- package/NOTICE +27 -0
- package/README.md +29 -2
- package/dist/index.js +59 -0
- package/package.json +65 -4
- package/template/base/ai-chat/.env.example +6 -0
- package/template/base/ai-chat/.prettierignore +2 -0
- package/template/base/ai-chat/.prettierrc.json +5 -0
- package/template/base/ai-chat/README.md +38 -0
- package/template/base/ai-chat/_gitignore +41 -0
- package/template/base/ai-chat/components.json +23 -0
- package/template/base/ai-chat/next.config.ts +5 -0
- package/template/base/ai-chat/package.json +61 -0
- package/template/base/ai-chat/postcss.config.mjs +5 -0
- package/template/base/ai-chat/src/app/api/chat/route.ts +141 -0
- package/template/base/ai-chat/src/app/api/instant/route.ts +5 -0
- package/template/base/ai-chat/src/app/chat/[id]/page.tsx +20 -0
- package/template/base/ai-chat/src/app/globals.css +124 -0
- package/template/base/ai-chat/src/app/layout.tsx +34 -0
- package/template/base/ai-chat/src/app/page.tsx +6 -0
- package/template/base/ai-chat/src/components/AuthGate.tsx +15 -0
- package/template/base/ai-chat/src/components/Chat.tsx +228 -0
- package/template/base/ai-chat/src/components/InstantProvider.tsx +18 -0
- package/template/base/ai-chat/src/components/Login.tsx +163 -0
- package/template/base/ai-chat/src/components/Sidebar.tsx +100 -0
- package/template/base/ai-chat/src/components/ai-elements/agent.tsx +142 -0
- package/template/base/ai-chat/src/components/ai-elements/artifact.tsx +149 -0
- package/template/base/ai-chat/src/components/ai-elements/attachments.tsx +427 -0
- package/template/base/ai-chat/src/components/ai-elements/audio-player.tsx +229 -0
- package/template/base/ai-chat/src/components/ai-elements/canvas.tsx +26 -0
- package/template/base/ai-chat/src/components/ai-elements/chain-of-thought.tsx +223 -0
- package/template/base/ai-chat/src/components/ai-elements/checkpoint.tsx +72 -0
- package/template/base/ai-chat/src/components/ai-elements/code-block.tsx +556 -0
- package/template/base/ai-chat/src/components/ai-elements/commit.tsx +449 -0
- package/template/base/ai-chat/src/components/ai-elements/confirmation.tsx +173 -0
- package/template/base/ai-chat/src/components/ai-elements/connection.tsx +28 -0
- package/template/base/ai-chat/src/components/ai-elements/context.tsx +410 -0
- package/template/base/ai-chat/src/components/ai-elements/controls.tsx +19 -0
- package/template/base/ai-chat/src/components/ai-elements/conversation.tsx +167 -0
- package/template/base/ai-chat/src/components/ai-elements/edge.tsx +144 -0
- package/template/base/ai-chat/src/components/ai-elements/environment-variables.tsx +325 -0
- package/template/base/ai-chat/src/components/ai-elements/file-tree.tsx +298 -0
- package/template/base/ai-chat/src/components/ai-elements/image.tsx +25 -0
- package/template/base/ai-chat/src/components/ai-elements/inline-citation.tsx +294 -0
- package/template/base/ai-chat/src/components/ai-elements/jsx-preview.tsx +250 -0
- package/template/base/ai-chat/src/components/ai-elements/message.tsx +356 -0
- package/template/base/ai-chat/src/components/ai-elements/mic-selector.tsx +372 -0
- package/template/base/ai-chat/src/components/ai-elements/model-selector.tsx +214 -0
- package/template/base/ai-chat/src/components/ai-elements/node.tsx +72 -0
- package/template/base/ai-chat/src/components/ai-elements/open-in-chat.tsx +367 -0
- package/template/base/ai-chat/src/components/ai-elements/package-info.tsx +235 -0
- package/template/base/ai-chat/src/components/ai-elements/panel.tsx +16 -0
- package/template/base/ai-chat/src/components/ai-elements/persona.tsx +280 -0
- package/template/base/ai-chat/src/components/ai-elements/plan.tsx +144 -0
- package/template/base/ai-chat/src/components/ai-elements/prompt-input.tsx +1341 -0
- package/template/base/ai-chat/src/components/ai-elements/queue.tsx +275 -0
- package/template/base/ai-chat/src/components/ai-elements/reasoning.tsx +229 -0
- package/template/base/ai-chat/src/components/ai-elements/sandbox.tsx +128 -0
- package/template/base/ai-chat/src/components/ai-elements/schema-display.tsx +473 -0
- package/template/base/ai-chat/src/components/ai-elements/shimmer.tsx +78 -0
- package/template/base/ai-chat/src/components/ai-elements/snippet.tsx +141 -0
- package/template/base/ai-chat/src/components/ai-elements/sources.tsx +78 -0
- package/template/base/ai-chat/src/components/ai-elements/speech-input.tsx +324 -0
- package/template/base/ai-chat/src/components/ai-elements/stack-trace.tsx +531 -0
- package/template/base/ai-chat/src/components/ai-elements/suggestion.tsx +55 -0
- package/template/base/ai-chat/src/components/ai-elements/task.tsx +88 -0
- package/template/base/ai-chat/src/components/ai-elements/terminal.tsx +277 -0
- package/template/base/ai-chat/src/components/ai-elements/test-results.tsx +497 -0
- package/template/base/ai-chat/src/components/ai-elements/tool.tsx +174 -0
- package/template/base/ai-chat/src/components/ai-elements/toolbar.tsx +17 -0
- package/template/base/ai-chat/src/components/ai-elements/transcription.tsx +126 -0
- package/template/base/ai-chat/src/components/ai-elements/voice-selector.tsx +525 -0
- package/template/base/ai-chat/src/components/ai-elements/web-preview.tsx +282 -0
- package/template/base/ai-chat/src/components/ui/accordion.tsx +66 -0
- package/template/base/ai-chat/src/components/ui/alert.tsx +66 -0
- package/template/base/ai-chat/src/components/ui/avatar.tsx +109 -0
- package/template/base/ai-chat/src/components/ui/badge.tsx +48 -0
- package/template/base/ai-chat/src/components/ui/button-group.tsx +83 -0
- package/template/base/ai-chat/src/components/ui/button.tsx +64 -0
- package/template/base/ai-chat/src/components/ui/card.tsx +92 -0
- package/template/base/ai-chat/src/components/ui/carousel.tsx +241 -0
- package/template/base/ai-chat/src/components/ui/collapsible.tsx +33 -0
- package/template/base/ai-chat/src/components/ui/command.tsx +184 -0
- package/template/base/ai-chat/src/components/ui/dialog.tsx +158 -0
- package/template/base/ai-chat/src/components/ui/dropdown-menu.tsx +257 -0
- package/template/base/ai-chat/src/components/ui/hover-card.tsx +44 -0
- package/template/base/ai-chat/src/components/ui/input-group.tsx +170 -0
- package/template/base/ai-chat/src/components/ui/input.tsx +21 -0
- package/template/base/ai-chat/src/components/ui/popover.tsx +89 -0
- package/template/base/ai-chat/src/components/ui/progress.tsx +31 -0
- package/template/base/ai-chat/src/components/ui/scroll-area.tsx +58 -0
- package/template/base/ai-chat/src/components/ui/select.tsx +190 -0
- package/template/base/ai-chat/src/components/ui/separator.tsx +28 -0
- package/template/base/ai-chat/src/components/ui/spinner.tsx +16 -0
- package/template/base/ai-chat/src/components/ui/switch.tsx +35 -0
- package/template/base/ai-chat/src/components/ui/tabs.tsx +91 -0
- package/template/base/ai-chat/src/components/ui/textarea.tsx +18 -0
- package/template/base/ai-chat/src/components/ui/tooltip.tsx +57 -0
- package/template/base/ai-chat/src/instant.perms.ts +34 -0
- package/template/base/ai-chat/src/instant.schema.ts +107 -0
- package/template/base/ai-chat/src/lib/adminDb.ts +8 -0
- package/template/base/ai-chat/src/lib/db.ts +8 -0
- package/template/base/ai-chat/src/lib/mockModel.ts +119 -0
- package/template/base/ai-chat/src/lib/utils.ts +6 -0
- package/template/base/ai-chat/tsconfig.json +33 -0
- package/template/base/bun-react/.env.example +2 -0
- package/template/base/bun-react/README.md +12 -0
- package/template/base/bun-react/_gitignore +34 -0
- package/template/base/bun-react/bun-env.d.ts +17 -0
- package/template/base/bun-react/bunfig.toml +4 -0
- package/template/base/bun-react/package.json +22 -0
- package/template/base/bun-react/src/App.tsx +168 -0
- package/template/base/bun-react/src/frontend.tsx +20 -0
- package/template/base/bun-react/src/getUnusedPort.ts +32 -0
- package/template/base/bun-react/src/index.css +25 -0
- package/template/base/bun-react/src/index.html +13 -0
- package/template/base/bun-react/src/index.ts +21 -0
- package/template/base/bun-react/src/instant.perms.ts +24 -0
- package/template/base/bun-react/src/instant.schema.ts +46 -0
- package/template/base/bun-react/src/lib/db.ts +8 -0
- package/template/base/bun-react/src/logo.svg +1 -0
- package/template/base/bun-react/tsconfig.json +36 -0
- package/template/base/expo/.env.example +2 -0
- package/template/base/expo/README.md +18 -0
- package/template/base/expo/_gitignore +41 -0
- package/template/base/expo/app/+not-found.tsx +16 -0
- package/template/base/expo/app/_layout.tsx +37 -0
- package/template/base/expo/app/index.tsx +64 -0
- package/template/base/expo/app.json +42 -0
- package/template/base/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/template/base/expo/assets/images/adaptive-icon.png +0 -0
- package/template/base/expo/assets/images/favicon.png +0 -0
- package/template/base/expo/assets/images/icon.png +0 -0
- package/template/base/expo/assets/images/partial-react-logo.png +0 -0
- package/template/base/expo/assets/images/react-logo.png +0 -0
- package/template/base/expo/assets/images/react-logo@2x.png +0 -0
- package/template/base/expo/assets/images/react-logo@3x.png +0 -0
- package/template/base/expo/assets/images/splash-icon.png +0 -0
- package/template/base/expo/babel.config.js +12 -0
- package/template/base/expo/constants/Colors.ts +26 -0
- package/template/base/expo/eslint.config.js +10 -0
- package/template/base/expo/global.css +3 -0
- package/template/base/expo/hooks/useColorScheme.ts +1 -0
- package/template/base/expo/hooks/useColorScheme.web.ts +21 -0
- package/template/base/expo/hooks/useThemeColor.ts +21 -0
- package/template/base/expo/instant.perms.ts +24 -0
- package/template/base/expo/instant.schema.ts +44 -0
- package/template/base/expo/lib/db.ts +7 -0
- package/template/base/expo/metro.config.js +6 -0
- package/template/base/expo/nativewind-env.d.ts +1 -0
- package/template/base/expo/package.json +57 -0
- package/template/base/expo/scripts/reset-project.js +112 -0
- package/template/base/expo/tailwind.config.js +9 -0
- package/template/base/expo/tsconfig.json +18 -0
- package/template/base/next-js-app-dir/.env.example +2 -0
- package/template/base/next-js-app-dir/README.md +18 -0
- package/template/base/next-js-app-dir/_gitignore +41 -0
- package/template/base/next-js-app-dir/next.config.ts +7 -0
- package/template/base/next-js-app-dir/package.json +27 -0
- package/template/base/next-js-app-dir/postcss.config.mjs +5 -0
- package/template/base/next-js-app-dir/public/file.svg +1 -0
- package/template/base/next-js-app-dir/public/globe.svg +1 -0
- package/template/base/next-js-app-dir/public/next.svg +1 -0
- package/template/base/next-js-app-dir/public/vercel.svg +1 -0
- package/template/base/next-js-app-dir/public/window.svg +1 -0
- package/template/base/next-js-app-dir/src/app/favicon.ico +0 -0
- package/template/base/next-js-app-dir/src/app/globals.css +26 -0
- package/template/base/next-js-app-dir/src/app/layout.tsx +34 -0
- package/template/base/next-js-app-dir/src/app/page.tsx +169 -0
- package/template/base/next-js-app-dir/src/instant.perms.ts +24 -0
- package/template/base/next-js-app-dir/src/instant.schema.ts +50 -0
- package/template/base/next-js-app-dir/src/lib/db.ts +8 -0
- package/template/base/next-js-app-dir/tsconfig.json +41 -0
- package/template/base/solidjs-vite/README.md +15 -0
- package/template/base/solidjs-vite/_gitignore +25 -0
- package/template/base/solidjs-vite/index.html +15 -0
- package/template/base/solidjs-vite/package.json +25 -0
- package/template/base/solidjs-vite/src/App.tsx +171 -0
- package/template/base/solidjs-vite/src/index.css +25 -0
- package/template/base/solidjs-vite/src/index.tsx +16 -0
- package/template/base/solidjs-vite/src/instant.perms.ts +24 -0
- package/template/base/solidjs-vite/src/instant.schema.ts +46 -0
- package/template/base/solidjs-vite/src/lib/db.ts +8 -0
- package/template/base/solidjs-vite/tsconfig.json +20 -0
- package/template/base/solidjs-vite/vite.config.ts +11 -0
- package/template/base/sveltekit/README.md +15 -0
- package/template/base/sveltekit/_gitignore +26 -0
- package/template/base/sveltekit/package.json +25 -0
- package/template/base/sveltekit/src/app.css +25 -0
- package/template/base/sveltekit/src/app.html +11 -0
- package/template/base/sveltekit/src/instant.perms.ts +24 -0
- package/template/base/sveltekit/src/instant.schema.ts +46 -0
- package/template/base/sveltekit/src/lib/db.ts +8 -0
- package/template/base/sveltekit/src/routes/+layout.svelte +6 -0
- package/template/base/sveltekit/src/routes/+page.svelte +236 -0
- package/template/base/sveltekit/src/routes/+page.ts +1 -0
- package/template/base/sveltekit/svelte.config.js +10 -0
- package/template/base/sveltekit/tsconfig.json +14 -0
- package/template/base/sveltekit/vite.config.ts +7 -0
- package/template/base/tanstack-start/.cta.json +12 -0
- package/template/base/tanstack-start/README.md +17 -0
- package/template/base/tanstack-start/_gitignore +13 -0
- package/template/base/tanstack-start/package.json +43 -0
- package/template/base/tanstack-start/public/favicon.ico +0 -0
- package/template/base/tanstack-start/public/logo192.png +0 -0
- package/template/base/tanstack-start/public/logo512.png +0 -0
- package/template/base/tanstack-start/public/manifest.json +25 -0
- package/template/base/tanstack-start/public/robots.txt +3 -0
- package/template/base/tanstack-start/public/tanstack-circle-logo.png +0 -0
- package/template/base/tanstack-start/public/tanstack-word-logo-white.svg +1 -0
- package/template/base/tanstack-start/src/components/Header.tsx +21 -0
- package/template/base/tanstack-start/src/instant.perms.ts +24 -0
- package/template/base/tanstack-start/src/instant.schema.ts +50 -0
- package/template/base/tanstack-start/src/lib/adminDb.ts +12 -0
- package/template/base/tanstack-start/src/lib/db.ts +9 -0
- package/template/base/tanstack-start/src/logo.svg +12 -0
- package/template/base/tanstack-start/src/routeTree.gen.ts +104 -0
- package/template/base/tanstack-start/src/router.tsx +22 -0
- package/template/base/tanstack-start/src/routes/__root.tsx +70 -0
- package/template/base/tanstack-start/src/routes/api/instant.ts +18 -0
- package/template/base/tanstack-start/src/routes/index.tsx +238 -0
- package/template/base/tanstack-start/src/routes/login.tsx +140 -0
- package/template/base/tanstack-start/src/styles.css +18 -0
- package/template/base/tanstack-start/tsconfig.json +28 -0
- package/template/base/tanstack-start/vite.config.ts +33 -0
- package/template/base/tanstack-start-with-tanstack-query/.cta.json +12 -0
- package/template/base/tanstack-start-with-tanstack-query/README.md +18 -0
- package/template/base/tanstack-start-with-tanstack-query/_gitignore +13 -0
- package/template/base/tanstack-start-with-tanstack-query/package.json +46 -0
- package/template/base/tanstack-start-with-tanstack-query/public/favicon.ico +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/logo192.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/logo512.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/manifest.json +25 -0
- package/template/base/tanstack-start-with-tanstack-query/public/robots.txt +3 -0
- package/template/base/tanstack-start-with-tanstack-query/public/tanstack-circle-logo.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/tanstack-word-logo-white.svg +1 -0
- package/template/base/tanstack-start-with-tanstack-query/src/components/Header.tsx +21 -0
- package/template/base/tanstack-start-with-tanstack-query/src/instant.perms.ts +24 -0
- package/template/base/tanstack-start-with-tanstack-query/src/instant.schema.ts +50 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/adminDb.ts +9 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/db.ts +11 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/instantQuery.ts +93 -0
- package/template/base/tanstack-start-with-tanstack-query/src/logo.svg +12 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routeTree.gen.ts +104 -0
- package/template/base/tanstack-start-with-tanstack-query/src/router.tsx +108 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/__root.tsx +76 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/api/instant.ts +16 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/index.tsx +231 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/login.tsx +140 -0
- package/template/base/tanstack-start-with-tanstack-query/src/styles.css +17 -0
- package/template/base/tanstack-start-with-tanstack-query/tsconfig.json +28 -0
- package/template/base/tanstack-start-with-tanstack-query/vite.config.ts +33 -0
- package/template/base/vite-react/README.md +16 -0
- package/template/base/vite-react/_gitignore +26 -0
- package/template/base/vite-react/eslint.config.js +23 -0
- package/template/base/vite-react/index.html +13 -0
- package/template/base/vite-react/package.json +35 -0
- package/template/base/vite-react/public/favicon.svg +1 -0
- package/template/base/vite-react/src/App.tsx +167 -0
- package/template/base/vite-react/src/index.css +1 -0
- package/template/base/vite-react/src/instant.perms.ts +24 -0
- package/template/base/vite-react/src/instant.schema.ts +51 -0
- package/template/base/vite-react/src/lib/db.ts +8 -0
- package/template/base/vite-react/src/main.tsx +10 -0
- package/template/base/vite-react/tsconfig.app.json +25 -0
- package/template/base/vite-react/tsconfig.json +7 -0
- package/template/base/vite-react/tsconfig.node.json +24 -0
- package/template/base/vite-react/vite.config.ts +8 -0
- package/template/base/vite-vanilla/.env.example +2 -0
- package/template/base/vite-vanilla/README.md +17 -0
- package/template/base/vite-vanilla/_gitignore +25 -0
- package/template/base/vite-vanilla/index.html +13 -0
- package/template/base/vite-vanilla/package.json +20 -0
- package/template/base/vite-vanilla/pnpm-lock.yaml +707 -0
- package/template/base/vite-vanilla/public/vite.svg +1 -0
- package/template/base/vite-vanilla/src/instant.perms.ts +24 -0
- package/template/base/vite-vanilla/src/instant.schema.ts +50 -0
- package/template/base/vite-vanilla/src/lib/db.ts +11 -0
- package/template/base/vite-vanilla/src/main.ts +242 -0
- package/template/base/vite-vanilla/src/style.css +96 -0
- package/template/base/vite-vanilla/src/typescript.svg +1 -0
- package/template/base/vite-vanilla/src/vite-env.d.ts +1 -0
- package/template/base/vite-vanilla/tsconfig.json +24 -0
- package/template/base/vue-vite/README.md +15 -0
- package/template/base/vue-vite/_gitignore +43 -0
- package/template/base/vue-vite/env.d.ts +1 -0
- package/template/base/vue-vite/index.html +12 -0
- package/template/base/vue-vite/package.json +34 -0
- package/template/base/vue-vite/src/App.vue +238 -0
- package/template/base/vue-vite/src/assets/main.css +25 -0
- package/template/base/vue-vite/src/instant.perms.ts +24 -0
- package/template/base/vue-vite/src/instant.schema.ts +46 -0
- package/template/base/vue-vite/src/lib/db.ts +8 -0
- package/template/base/vue-vite/src/main.ts +6 -0
- package/template/base/vue-vite/tsconfig.app.json +15 -0
- package/template/base/vue-vite/tsconfig.json +11 -0
- package/template/base/vue-vite/tsconfig.node.json +27 -0
- package/template/base/vue-vite/vite.config.ts +16 -0
- package/template/rules/AGENTS.md +450 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Button } from '@/components/ui/button';
|
|
6
|
+
import {
|
|
7
|
+
Collapsible,
|
|
8
|
+
CollapsibleContent,
|
|
9
|
+
CollapsibleTrigger,
|
|
10
|
+
} from '@/components/ui/collapsible';
|
|
11
|
+
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
12
|
+
import { cn } from '@/lib/utils';
|
|
13
|
+
import { ChevronDownIcon, PaperclipIcon } from 'lucide-react';
|
|
14
|
+
|
|
15
|
+
export interface QueueMessagePart {
|
|
16
|
+
type: string;
|
|
17
|
+
text?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
filename?: string;
|
|
20
|
+
mediaType?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface QueueMessage {
|
|
24
|
+
id: string;
|
|
25
|
+
parts: QueueMessagePart[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface QueueTodo {
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
status?: 'pending' | 'completed';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type QueueItemProps = ComponentProps<'li'>;
|
|
36
|
+
|
|
37
|
+
export const QueueItem = ({ className, ...props }: QueueItemProps) => (
|
|
38
|
+
<li
|
|
39
|
+
className={cn(
|
|
40
|
+
'group hover:bg-muted flex flex-col gap-1 rounded-md px-3 py-1 text-sm transition-colors',
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export type QueueItemIndicatorProps = ComponentProps<'span'> & {
|
|
48
|
+
completed?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const QueueItemIndicator = ({
|
|
52
|
+
completed = false,
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: QueueItemIndicatorProps) => (
|
|
56
|
+
<span
|
|
57
|
+
className={cn(
|
|
58
|
+
'mt-0.5 inline-block size-2.5 rounded-full border',
|
|
59
|
+
completed
|
|
60
|
+
? 'border-muted-foreground/20 bg-muted-foreground/10'
|
|
61
|
+
: 'border-muted-foreground/50',
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export type QueueItemContentProps = ComponentProps<'span'> & {
|
|
69
|
+
completed?: boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const QueueItemContent = ({
|
|
73
|
+
completed = false,
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: QueueItemContentProps) => (
|
|
77
|
+
<span
|
|
78
|
+
className={cn(
|
|
79
|
+
'line-clamp-1 grow break-words',
|
|
80
|
+
completed
|
|
81
|
+
? 'text-muted-foreground/50 line-through'
|
|
82
|
+
: 'text-muted-foreground',
|
|
83
|
+
className,
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export type QueueItemDescriptionProps = ComponentProps<'div'> & {
|
|
90
|
+
completed?: boolean;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const QueueItemDescription = ({
|
|
94
|
+
completed = false,
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: QueueItemDescriptionProps) => (
|
|
98
|
+
<div
|
|
99
|
+
className={cn(
|
|
100
|
+
'ml-6 text-xs',
|
|
101
|
+
completed
|
|
102
|
+
? 'text-muted-foreground/40 line-through'
|
|
103
|
+
: 'text-muted-foreground',
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
export type QueueItemActionsProps = ComponentProps<'div'>;
|
|
111
|
+
|
|
112
|
+
export const QueueItemActions = ({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}: QueueItemActionsProps) => (
|
|
116
|
+
<div className={cn('flex gap-1', className)} {...props} />
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
export type QueueItemActionProps = Omit<
|
|
120
|
+
ComponentProps<typeof Button>,
|
|
121
|
+
'variant' | 'size'
|
|
122
|
+
>;
|
|
123
|
+
|
|
124
|
+
export const QueueItemAction = ({
|
|
125
|
+
className,
|
|
126
|
+
...props
|
|
127
|
+
}: QueueItemActionProps) => (
|
|
128
|
+
<Button
|
|
129
|
+
className={cn(
|
|
130
|
+
'text-muted-foreground hover:bg-muted-foreground/10 hover:text-foreground size-auto rounded p-1 opacity-0 transition-opacity group-hover:opacity-100',
|
|
131
|
+
className,
|
|
132
|
+
)}
|
|
133
|
+
size="icon"
|
|
134
|
+
type="button"
|
|
135
|
+
variant="ghost"
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
export type QueueItemAttachmentProps = ComponentProps<'div'>;
|
|
141
|
+
|
|
142
|
+
export const QueueItemAttachment = ({
|
|
143
|
+
className,
|
|
144
|
+
...props
|
|
145
|
+
}: QueueItemAttachmentProps) => (
|
|
146
|
+
<div className={cn('mt-1 flex flex-wrap gap-2', className)} {...props} />
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
export type QueueItemImageProps = ComponentProps<'img'>;
|
|
150
|
+
|
|
151
|
+
export const QueueItemImage = ({
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}: QueueItemImageProps) => (
|
|
155
|
+
<img
|
|
156
|
+
alt=""
|
|
157
|
+
className={cn('h-8 w-8 rounded border object-cover', className)}
|
|
158
|
+
height={32}
|
|
159
|
+
width={32}
|
|
160
|
+
{...props}
|
|
161
|
+
/>
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
export type QueueItemFileProps = ComponentProps<'span'>;
|
|
165
|
+
|
|
166
|
+
export const QueueItemFile = ({
|
|
167
|
+
children,
|
|
168
|
+
className,
|
|
169
|
+
...props
|
|
170
|
+
}: QueueItemFileProps) => (
|
|
171
|
+
<span
|
|
172
|
+
className={cn(
|
|
173
|
+
'bg-muted flex items-center gap-1 rounded border px-2 py-1 text-xs',
|
|
174
|
+
className,
|
|
175
|
+
)}
|
|
176
|
+
{...props}
|
|
177
|
+
>
|
|
178
|
+
<PaperclipIcon size={12} />
|
|
179
|
+
<span className="max-w-[100px] truncate">{children}</span>
|
|
180
|
+
</span>
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
export type QueueListProps = ComponentProps<typeof ScrollArea>;
|
|
184
|
+
|
|
185
|
+
export const QueueList = ({
|
|
186
|
+
children,
|
|
187
|
+
className,
|
|
188
|
+
...props
|
|
189
|
+
}: QueueListProps) => (
|
|
190
|
+
<ScrollArea className={cn('mt-2 -mb-1', className)} {...props}>
|
|
191
|
+
<div className="max-h-40 pr-4">
|
|
192
|
+
<ul>{children}</ul>
|
|
193
|
+
</div>
|
|
194
|
+
</ScrollArea>
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
// QueueSection - collapsible section container
|
|
198
|
+
export type QueueSectionProps = ComponentProps<typeof Collapsible>;
|
|
199
|
+
|
|
200
|
+
export const QueueSection = ({
|
|
201
|
+
className,
|
|
202
|
+
defaultOpen = true,
|
|
203
|
+
...props
|
|
204
|
+
}: QueueSectionProps) => (
|
|
205
|
+
<Collapsible className={cn(className)} defaultOpen={defaultOpen} {...props} />
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
// QueueSectionTrigger - section header/trigger
|
|
209
|
+
export type QueueSectionTriggerProps = ComponentProps<'button'>;
|
|
210
|
+
|
|
211
|
+
export const QueueSectionTrigger = ({
|
|
212
|
+
children,
|
|
213
|
+
className,
|
|
214
|
+
...props
|
|
215
|
+
}: QueueSectionTriggerProps) => (
|
|
216
|
+
<CollapsibleTrigger asChild>
|
|
217
|
+
<button
|
|
218
|
+
className={cn(
|
|
219
|
+
'group bg-muted/40 text-muted-foreground hover:bg-muted flex w-full items-center justify-between rounded-md px-3 py-2 text-left text-sm font-medium transition-colors',
|
|
220
|
+
className,
|
|
221
|
+
)}
|
|
222
|
+
type="button"
|
|
223
|
+
{...props}
|
|
224
|
+
>
|
|
225
|
+
{children}
|
|
226
|
+
</button>
|
|
227
|
+
</CollapsibleTrigger>
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
// QueueSectionLabel - label content with icon and count
|
|
231
|
+
export type QueueSectionLabelProps = ComponentProps<'span'> & {
|
|
232
|
+
count?: number;
|
|
233
|
+
label: string;
|
|
234
|
+
icon?: React.ReactNode;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export const QueueSectionLabel = ({
|
|
238
|
+
count,
|
|
239
|
+
label,
|
|
240
|
+
icon,
|
|
241
|
+
className,
|
|
242
|
+
...props
|
|
243
|
+
}: QueueSectionLabelProps) => (
|
|
244
|
+
<span className={cn('flex items-center gap-2', className)} {...props}>
|
|
245
|
+
<ChevronDownIcon className="size-4 transition-transform group-data-[state=closed]:-rotate-90" />
|
|
246
|
+
{icon}
|
|
247
|
+
<span>
|
|
248
|
+
{count} {label}
|
|
249
|
+
</span>
|
|
250
|
+
</span>
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
// QueueSectionContent - collapsible content area
|
|
254
|
+
export type QueueSectionContentProps = ComponentProps<
|
|
255
|
+
typeof CollapsibleContent
|
|
256
|
+
>;
|
|
257
|
+
|
|
258
|
+
export const QueueSectionContent = ({
|
|
259
|
+
className,
|
|
260
|
+
...props
|
|
261
|
+
}: QueueSectionContentProps) => (
|
|
262
|
+
<CollapsibleContent className={cn(className)} {...props} />
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
export type QueueProps = ComponentProps<'div'>;
|
|
266
|
+
|
|
267
|
+
export const Queue = ({ className, ...props }: QueueProps) => (
|
|
268
|
+
<div
|
|
269
|
+
className={cn(
|
|
270
|
+
'border-border bg-background flex flex-col gap-2 rounded-xl border px-3 pt-2 pb-2 shadow-xs',
|
|
271
|
+
className,
|
|
272
|
+
)}
|
|
273
|
+
{...props}
|
|
274
|
+
/>
|
|
275
|
+
);
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
6
|
+
import {
|
|
7
|
+
Collapsible,
|
|
8
|
+
CollapsibleContent,
|
|
9
|
+
CollapsibleTrigger,
|
|
10
|
+
} from '@/components/ui/collapsible';
|
|
11
|
+
import { cn } from '@/lib/utils';
|
|
12
|
+
import { cjk } from '@streamdown/cjk';
|
|
13
|
+
import { code } from '@streamdown/code';
|
|
14
|
+
import { math } from '@streamdown/math';
|
|
15
|
+
import { mermaid } from '@streamdown/mermaid';
|
|
16
|
+
import { BrainIcon, ChevronDownIcon } from 'lucide-react';
|
|
17
|
+
import {
|
|
18
|
+
createContext,
|
|
19
|
+
memo,
|
|
20
|
+
useCallback,
|
|
21
|
+
useContext,
|
|
22
|
+
useEffect,
|
|
23
|
+
useMemo,
|
|
24
|
+
useRef,
|
|
25
|
+
useState,
|
|
26
|
+
} from 'react';
|
|
27
|
+
import { Streamdown } from 'streamdown';
|
|
28
|
+
|
|
29
|
+
import { Shimmer } from './shimmer';
|
|
30
|
+
|
|
31
|
+
interface ReasoningContextValue {
|
|
32
|
+
isStreaming: boolean;
|
|
33
|
+
isOpen: boolean;
|
|
34
|
+
setIsOpen: (open: boolean) => void;
|
|
35
|
+
duration: number | undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ReasoningContext = createContext<ReasoningContextValue | null>(null);
|
|
39
|
+
|
|
40
|
+
export const useReasoning = () => {
|
|
41
|
+
const context = useContext(ReasoningContext);
|
|
42
|
+
if (!context) {
|
|
43
|
+
throw new Error('Reasoning components must be used within Reasoning');
|
|
44
|
+
}
|
|
45
|
+
return context;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type ReasoningProps = ComponentProps<typeof Collapsible> & {
|
|
49
|
+
isStreaming?: boolean;
|
|
50
|
+
open?: boolean;
|
|
51
|
+
defaultOpen?: boolean;
|
|
52
|
+
onOpenChange?: (open: boolean) => void;
|
|
53
|
+
duration?: number;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const AUTO_CLOSE_DELAY = 1000;
|
|
57
|
+
const MS_IN_S = 1000;
|
|
58
|
+
|
|
59
|
+
export const Reasoning = memo(
|
|
60
|
+
({
|
|
61
|
+
className,
|
|
62
|
+
isStreaming = false,
|
|
63
|
+
open,
|
|
64
|
+
defaultOpen,
|
|
65
|
+
onOpenChange,
|
|
66
|
+
duration: durationProp,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}: ReasoningProps) => {
|
|
70
|
+
const resolvedDefaultOpen = defaultOpen ?? isStreaming;
|
|
71
|
+
// Track if defaultOpen was explicitly set to false (to prevent auto-open)
|
|
72
|
+
const isExplicitlyClosed = defaultOpen === false;
|
|
73
|
+
|
|
74
|
+
const [isOpen, setIsOpen] = useControllableState<boolean>({
|
|
75
|
+
defaultProp: resolvedDefaultOpen,
|
|
76
|
+
onChange: onOpenChange,
|
|
77
|
+
prop: open,
|
|
78
|
+
});
|
|
79
|
+
const [duration, setDuration] = useControllableState<number | undefined>({
|
|
80
|
+
defaultProp: undefined,
|
|
81
|
+
prop: durationProp,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const hasEverStreamedRef = useRef(isStreaming);
|
|
85
|
+
const [hasAutoClosed, setHasAutoClosed] = useState(false);
|
|
86
|
+
const startTimeRef = useRef<number | null>(null);
|
|
87
|
+
|
|
88
|
+
// Track when streaming starts and compute duration
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (isStreaming) {
|
|
91
|
+
hasEverStreamedRef.current = true;
|
|
92
|
+
if (startTimeRef.current === null) {
|
|
93
|
+
startTimeRef.current = Date.now();
|
|
94
|
+
}
|
|
95
|
+
} else if (startTimeRef.current !== null) {
|
|
96
|
+
setDuration(Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S));
|
|
97
|
+
startTimeRef.current = null;
|
|
98
|
+
}
|
|
99
|
+
}, [isStreaming, setDuration]);
|
|
100
|
+
|
|
101
|
+
// Auto-open when streaming starts (unless explicitly closed)
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (isStreaming && !isOpen && !isExplicitlyClosed) {
|
|
104
|
+
setIsOpen(true);
|
|
105
|
+
}
|
|
106
|
+
}, [isStreaming, isOpen, setIsOpen, isExplicitlyClosed]);
|
|
107
|
+
|
|
108
|
+
// Auto-close when streaming ends (once only, and only if it ever streamed)
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (
|
|
111
|
+
hasEverStreamedRef.current &&
|
|
112
|
+
!isStreaming &&
|
|
113
|
+
isOpen &&
|
|
114
|
+
!hasAutoClosed
|
|
115
|
+
) {
|
|
116
|
+
const timer = setTimeout(() => {
|
|
117
|
+
setIsOpen(false);
|
|
118
|
+
setHasAutoClosed(true);
|
|
119
|
+
}, AUTO_CLOSE_DELAY);
|
|
120
|
+
|
|
121
|
+
return () => clearTimeout(timer);
|
|
122
|
+
}
|
|
123
|
+
}, [isStreaming, isOpen, setIsOpen, hasAutoClosed]);
|
|
124
|
+
|
|
125
|
+
const handleOpenChange = useCallback(
|
|
126
|
+
(newOpen: boolean) => {
|
|
127
|
+
setIsOpen(newOpen);
|
|
128
|
+
},
|
|
129
|
+
[setIsOpen],
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const contextValue = useMemo(
|
|
133
|
+
() => ({ duration, isOpen, isStreaming, setIsOpen }),
|
|
134
|
+
[duration, isOpen, isStreaming, setIsOpen],
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<ReasoningContext.Provider value={contextValue}>
|
|
139
|
+
<Collapsible
|
|
140
|
+
className={cn('not-prose mb-4', className)}
|
|
141
|
+
onOpenChange={handleOpenChange}
|
|
142
|
+
open={isOpen}
|
|
143
|
+
{...props}
|
|
144
|
+
>
|
|
145
|
+
{children}
|
|
146
|
+
</Collapsible>
|
|
147
|
+
</ReasoningContext.Provider>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
export type ReasoningTriggerProps = ComponentProps<
|
|
153
|
+
typeof CollapsibleTrigger
|
|
154
|
+
> & {
|
|
155
|
+
getThinkingMessage?: (isStreaming: boolean, duration?: number) => ReactNode;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const defaultGetThinkingMessage = (isStreaming: boolean, duration?: number) => {
|
|
159
|
+
if (isStreaming || duration === 0) {
|
|
160
|
+
return <Shimmer duration={1}>Thinking...</Shimmer>;
|
|
161
|
+
}
|
|
162
|
+
if (duration === undefined) {
|
|
163
|
+
return <p>Thought for a few seconds</p>;
|
|
164
|
+
}
|
|
165
|
+
return <p>Thought for {duration} seconds</p>;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const ReasoningTrigger = memo(
|
|
169
|
+
({
|
|
170
|
+
className,
|
|
171
|
+
children,
|
|
172
|
+
getThinkingMessage = defaultGetThinkingMessage,
|
|
173
|
+
...props
|
|
174
|
+
}: ReasoningTriggerProps) => {
|
|
175
|
+
const { isStreaming, isOpen, duration } = useReasoning();
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<CollapsibleTrigger
|
|
179
|
+
className={cn(
|
|
180
|
+
'text-muted-foreground hover:text-foreground flex w-full items-center gap-2 text-sm transition-colors',
|
|
181
|
+
className,
|
|
182
|
+
)}
|
|
183
|
+
{...props}
|
|
184
|
+
>
|
|
185
|
+
{children ?? (
|
|
186
|
+
<>
|
|
187
|
+
<BrainIcon className="size-4" />
|
|
188
|
+
{getThinkingMessage(isStreaming, duration)}
|
|
189
|
+
<ChevronDownIcon
|
|
190
|
+
className={cn(
|
|
191
|
+
'size-4 transition-transform',
|
|
192
|
+
isOpen ? 'rotate-180' : 'rotate-0',
|
|
193
|
+
)}
|
|
194
|
+
/>
|
|
195
|
+
</>
|
|
196
|
+
)}
|
|
197
|
+
</CollapsibleTrigger>
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
export type ReasoningContentProps = ComponentProps<
|
|
203
|
+
typeof CollapsibleContent
|
|
204
|
+
> & {
|
|
205
|
+
children: string;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const streamdownPlugins = { cjk, code, math, mermaid };
|
|
209
|
+
|
|
210
|
+
export const ReasoningContent = memo(
|
|
211
|
+
({ className, children, ...props }: ReasoningContentProps) => (
|
|
212
|
+
<CollapsibleContent
|
|
213
|
+
className={cn(
|
|
214
|
+
'mt-4 text-sm',
|
|
215
|
+
'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground data-[state=closed]:animate-out data-[state=open]:animate-in outline-none',
|
|
216
|
+
className,
|
|
217
|
+
)}
|
|
218
|
+
{...props}
|
|
219
|
+
>
|
|
220
|
+
<Streamdown plugins={streamdownPlugins} {...props}>
|
|
221
|
+
{children}
|
|
222
|
+
</Streamdown>
|
|
223
|
+
</CollapsibleContent>
|
|
224
|
+
),
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
Reasoning.displayName = 'Reasoning';
|
|
228
|
+
ReasoningTrigger.displayName = 'ReasoningTrigger';
|
|
229
|
+
ReasoningContent.displayName = 'ReasoningContent';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ToolUIPart } from 'ai';
|
|
4
|
+
import type { ComponentProps } from 'react';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Collapsible,
|
|
8
|
+
CollapsibleContent,
|
|
9
|
+
CollapsibleTrigger,
|
|
10
|
+
} from '@/components/ui/collapsible';
|
|
11
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
12
|
+
import { cn } from '@/lib/utils';
|
|
13
|
+
import { ChevronDownIcon, Code } from 'lucide-react';
|
|
14
|
+
|
|
15
|
+
import { getStatusBadge } from './tool';
|
|
16
|
+
|
|
17
|
+
export type SandboxRootProps = ComponentProps<typeof Collapsible>;
|
|
18
|
+
|
|
19
|
+
export const Sandbox = ({ className, ...props }: SandboxRootProps) => (
|
|
20
|
+
<Collapsible
|
|
21
|
+
className={cn(
|
|
22
|
+
'not-prose group mb-4 w-full overflow-hidden rounded-md border',
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
defaultOpen
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export interface SandboxHeaderProps {
|
|
31
|
+
title?: string;
|
|
32
|
+
state: ToolUIPart['state'];
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const SandboxHeader = ({
|
|
37
|
+
className,
|
|
38
|
+
title,
|
|
39
|
+
state,
|
|
40
|
+
...props
|
|
41
|
+
}: SandboxHeaderProps) => (
|
|
42
|
+
<CollapsibleTrigger
|
|
43
|
+
className={cn(
|
|
44
|
+
'flex w-full items-center justify-between gap-4 p-3',
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
<div className="flex items-center gap-2">
|
|
50
|
+
<Code className="text-muted-foreground size-4" />
|
|
51
|
+
<span className="text-sm font-medium">{title}</span>
|
|
52
|
+
{getStatusBadge(state)}
|
|
53
|
+
</div>
|
|
54
|
+
<ChevronDownIcon className="text-muted-foreground size-4 transition-transform group-data-[state=open]:rotate-180" />
|
|
55
|
+
</CollapsibleTrigger>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export type SandboxContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
59
|
+
|
|
60
|
+
export const SandboxContent = ({
|
|
61
|
+
className,
|
|
62
|
+
...props
|
|
63
|
+
}: SandboxContentProps) => (
|
|
64
|
+
<CollapsibleContent
|
|
65
|
+
className={cn(
|
|
66
|
+
'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:animate-out data-[state=open]:animate-in outline-none',
|
|
67
|
+
className,
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export type SandboxTabsProps = ComponentProps<typeof Tabs>;
|
|
74
|
+
|
|
75
|
+
export const SandboxTabs = ({ className, ...props }: SandboxTabsProps) => (
|
|
76
|
+
<Tabs className={cn('w-full gap-0', className)} {...props} />
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
export type SandboxTabsBarProps = ComponentProps<'div'>;
|
|
80
|
+
|
|
81
|
+
export const SandboxTabsBar = ({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}: SandboxTabsBarProps) => (
|
|
85
|
+
<div
|
|
86
|
+
className={cn(
|
|
87
|
+
'border-border flex w-full items-center border-t border-b',
|
|
88
|
+
className,
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export type SandboxTabsListProps = ComponentProps<typeof TabsList>;
|
|
95
|
+
|
|
96
|
+
export const SandboxTabsList = ({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: SandboxTabsListProps) => (
|
|
100
|
+
<TabsList
|
|
101
|
+
className={cn('h-auto rounded-none border-0 bg-transparent p-0', className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
export type SandboxTabsTriggerProps = ComponentProps<typeof TabsTrigger>;
|
|
107
|
+
|
|
108
|
+
export const SandboxTabsTrigger = ({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: SandboxTabsTriggerProps) => (
|
|
112
|
+
<TabsTrigger
|
|
113
|
+
className={cn(
|
|
114
|
+
'text-muted-foreground data-[state=active]:border-primary data-[state=active]:text-foreground rounded-none border-0 border-b-2 border-transparent px-4 py-2 text-sm font-medium transition-colors data-[state=active]:bg-transparent data-[state=active]:shadow-none',
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
export type SandboxTabContentProps = ComponentProps<typeof TabsContent>;
|
|
122
|
+
|
|
123
|
+
export const SandboxTabContent = ({
|
|
124
|
+
className,
|
|
125
|
+
...props
|
|
126
|
+
}: SandboxTabContentProps) => (
|
|
127
|
+
<TabsContent className={cn('mt-0 text-sm', className)} {...props} />
|
|
128
|
+
);
|