@openconsole/shadcn 0.2.5 → 0.2.7

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.
Files changed (113) hide show
  1. package/components/index.ts +1 -2
  2. package/components/ui/accordion.tsx +66 -66
  3. package/components/ui/alert-dialog.tsx +196 -196
  4. package/components/ui/alert.tsx +66 -66
  5. package/components/ui/aspect-ratio.tsx +11 -11
  6. package/components/ui/avatar.tsx +53 -53
  7. package/components/ui/badge.tsx +46 -46
  8. package/components/ui/breadcrumb.tsx +109 -109
  9. package/components/ui/button-group.tsx +83 -83
  10. package/components/ui/button.tsx +60 -60
  11. package/components/ui/calendar.tsx +219 -219
  12. package/components/ui/card.tsx +92 -92
  13. package/components/ui/carousel.tsx +241 -241
  14. package/components/ui/chart.tsx +374 -374
  15. package/components/ui/checkbox.tsx +32 -32
  16. package/components/ui/collapsible.tsx +33 -33
  17. package/components/ui/command.tsx +184 -184
  18. package/components/ui/context-menu.tsx +252 -252
  19. package/components/ui/dialog.tsx +143 -143
  20. package/components/ui/direction.tsx +22 -22
  21. package/components/ui/drawer.tsx +135 -135
  22. package/components/ui/dropdown-menu.tsx +257 -257
  23. package/components/ui/empty.tsx +104 -104
  24. package/components/ui/field.tsx +248 -248
  25. package/components/ui/form.tsx +167 -167
  26. package/components/ui/hover-card.tsx +44 -44
  27. package/components/ui/index.ts +59 -59
  28. package/components/ui/input-group.tsx +170 -170
  29. package/components/ui/input-otp.tsx +77 -77
  30. package/components/ui/input.tsx +21 -21
  31. package/components/ui/item.tsx +193 -193
  32. package/components/ui/kbd.tsx +28 -28
  33. package/components/ui/label.tsx +24 -24
  34. package/components/ui/menubar.tsx +276 -276
  35. package/components/ui/native-select.tsx +62 -62
  36. package/components/ui/navigation-menu.tsx +168 -168
  37. package/components/ui/pagination.tsx +127 -127
  38. package/components/ui/popover.tsx +89 -89
  39. package/components/ui/progress.tsx +31 -31
  40. package/components/ui/radio-group.tsx +45 -45
  41. package/components/ui/resizable.tsx +53 -53
  42. package/components/ui/scroll-area.tsx +58 -58
  43. package/components/ui/select.tsx +187 -187
  44. package/components/ui/separator.tsx +28 -28
  45. package/components/ui/sheet.tsx +139 -139
  46. package/components/ui/sidebar.tsx +724 -724
  47. package/components/ui/skeleton.tsx +13 -13
  48. package/components/ui/slider.tsx +63 -63
  49. package/components/ui/sonner.tsx +40 -40
  50. package/components/ui/spinner.tsx +16 -16
  51. package/components/ui/switch.tsx +35 -35
  52. package/components/ui/table.tsx +116 -116
  53. package/components/ui/tabs.tsx +66 -66
  54. package/components/ui/textarea.tsx +18 -18
  55. package/components/ui/toggle-group.tsx +83 -83
  56. package/components/ui/toggle.tsx +47 -47
  57. package/components/ui/tooltip.tsx +61 -61
  58. package/hooks/index.ts +1 -1
  59. package/hooks/use-mobile.ts +19 -19
  60. package/index.ts +3 -3
  61. package/lib/index.ts +1 -1
  62. package/lib/utils.ts +6 -6
  63. package/package.json +1 -1
  64. package/styles.css +124 -124
  65. package/components/ai-elements/agent.tsx +0 -141
  66. package/components/ai-elements/artifact.tsx +0 -148
  67. package/components/ai-elements/attachments.tsx +0 -426
  68. package/components/ai-elements/audio-player.tsx +0 -231
  69. package/components/ai-elements/canvas.tsx +0 -26
  70. package/components/ai-elements/chain-of-thought.tsx +0 -222
  71. package/components/ai-elements/checkpoint.tsx +0 -71
  72. package/components/ai-elements/code-block.tsx +0 -562
  73. package/components/ai-elements/commit.tsx +0 -458
  74. package/components/ai-elements/confirmation.tsx +0 -174
  75. package/components/ai-elements/connection.tsx +0 -28
  76. package/components/ai-elements/context.tsx +0 -409
  77. package/components/ai-elements/controls.tsx +0 -18
  78. package/components/ai-elements/conversation.tsx +0 -168
  79. package/components/ai-elements/edge.tsx +0 -143
  80. package/components/ai-elements/environment-variables.tsx +0 -324
  81. package/components/ai-elements/file-tree.tsx +0 -304
  82. package/components/ai-elements/image.tsx +0 -24
  83. package/components/ai-elements/index.ts +0 -51
  84. package/components/ai-elements/inline-citation.tsx +0 -296
  85. package/components/ai-elements/jsx-preview.tsx +0 -310
  86. package/components/ai-elements/message.tsx +0 -360
  87. package/components/ai-elements/mic-selector.tsx +0 -375
  88. package/components/ai-elements/model-selector.tsx +0 -213
  89. package/components/ai-elements/node.tsx +0 -71
  90. package/components/ai-elements/open-in-chat.tsx +0 -370
  91. package/components/ai-elements/package-info.tsx +0 -239
  92. package/components/ai-elements/panel.tsx +0 -15
  93. package/components/ai-elements/persona.tsx +0 -306
  94. package/components/ai-elements/plan.tsx +0 -147
  95. package/components/ai-elements/prompt-input.tsx +0 -1463
  96. package/components/ai-elements/queue.tsx +0 -274
  97. package/components/ai-elements/reasoning.tsx +0 -228
  98. package/components/ai-elements/sandbox.tsx +0 -132
  99. package/components/ai-elements/schema-display.tsx +0 -471
  100. package/components/ai-elements/shimmer.tsx +0 -77
  101. package/components/ai-elements/snippet.tsx +0 -145
  102. package/components/ai-elements/sources.tsx +0 -77
  103. package/components/ai-elements/speech-input.tsx +0 -323
  104. package/components/ai-elements/stack-trace.tsx +0 -528
  105. package/components/ai-elements/suggestion.tsx +0 -57
  106. package/components/ai-elements/task.tsx +0 -87
  107. package/components/ai-elements/terminal.tsx +0 -273
  108. package/components/ai-elements/test-results.tsx +0 -496
  109. package/components/ai-elements/tool.tsx +0 -173
  110. package/components/ai-elements/toolbar.tsx +0 -16
  111. package/components/ai-elements/transcription.tsx +0 -125
  112. package/components/ai-elements/voice-selector.tsx +0 -524
  113. package/components/ai-elements/web-preview.tsx +0 -281
package/styles.css CHANGED
@@ -1,124 +1,124 @@
1
- @import "tw-animate-css";
2
-
3
- /* Register this package's source files as Tailwind content sources. */
4
- @source "./**/*.{ts,tsx}";
5
-
6
- @custom-variant dark (&:is(.dark *));
7
-
8
- @theme inline {
9
- --color-background: var(--background);
10
- --color-foreground: var(--foreground);
11
- --color-sidebar-ring: var(--sidebar-ring);
12
- --color-sidebar-border: var(--sidebar-border);
13
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
- --color-sidebar-accent: var(--sidebar-accent);
15
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
- --color-sidebar-primary: var(--sidebar-primary);
17
- --color-sidebar-foreground: var(--sidebar-foreground);
18
- --color-sidebar: var(--sidebar);
19
- --color-chart-5: var(--chart-5);
20
- --color-chart-4: var(--chart-4);
21
- --color-chart-3: var(--chart-3);
22
- --color-chart-2: var(--chart-2);
23
- --color-chart-1: var(--chart-1);
24
- --color-ring: var(--ring);
25
- --color-input: var(--input);
26
- --color-border: var(--border);
27
- --color-destructive: var(--destructive);
28
- --color-accent-foreground: var(--accent-foreground);
29
- --color-accent: var(--accent);
30
- --color-muted-foreground: var(--muted-foreground);
31
- --color-muted: var(--muted);
32
- --color-secondary-foreground: var(--secondary-foreground);
33
- --color-secondary: var(--secondary);
34
- --color-primary-foreground: var(--primary-foreground);
35
- --color-primary: var(--primary);
36
- --color-popover-foreground: var(--popover-foreground);
37
- --color-popover: var(--popover);
38
- --color-card-foreground: var(--card-foreground);
39
- --color-card: var(--card);
40
- --radius-sm: calc(var(--radius) - 4px);
41
- --radius-md: calc(var(--radius) - 2px);
42
- --radius-lg: var(--radius);
43
- --radius-xl: calc(var(--radius) + 4px);
44
- }
45
-
46
- :root {
47
- --radius: 0.625rem;
48
- --background: oklch(1 0 0);
49
- --foreground: oklch(0.145 0 0);
50
- --card: oklch(1 0 0);
51
- --card-foreground: oklch(0.145 0 0);
52
- --popover: oklch(1 0 0);
53
- --popover-foreground: oklch(0.145 0 0);
54
- /* 品牌主色 #17b3a3 (teal) */
55
- --primary: oklch(0.7 0.12 183);
56
- --primary-foreground: oklch(0.985 0 0);
57
- --secondary: oklch(0.97 0 0);
58
- --secondary-foreground: oklch(0.205 0 0);
59
- --muted: oklch(0.97 0 0);
60
- --muted-foreground: oklch(0.556 0 0);
61
- --accent: oklch(0.97 0 0);
62
- --accent-foreground: oklch(0.205 0 0);
63
- --destructive: oklch(0.577 0.245 27.325);
64
- --border: oklch(0.922 0 0);
65
- --input: oklch(0.922 0 0);
66
- --ring: oklch(0.7 0.12 183);
67
- --chart-1: oklch(0.646 0.222 41.116);
68
- --chart-2: oklch(0.6 0.118 184.704);
69
- --chart-3: oklch(0.398 0.07 227.392);
70
- --chart-4: oklch(0.828 0.189 84.429);
71
- --chart-5: oklch(0.769 0.188 70.08);
72
- --sidebar: oklch(0.985 0 0);
73
- --sidebar-foreground: oklch(0.145 0 0);
74
- --sidebar-primary: oklch(0.7 0.12 183);
75
- --sidebar-primary-foreground: oklch(0.985 0 0);
76
- --sidebar-accent: oklch(0.97 0 0);
77
- --sidebar-accent-foreground: oklch(0.205 0 0);
78
- --sidebar-border: oklch(0.922 0 0);
79
- --sidebar-ring: oklch(0.7 0.12 183);
80
- }
81
-
82
- .dark {
83
- --background: oklch(0.145 0 0);
84
- --foreground: oklch(0.985 0 0);
85
- --card: oklch(0.205 0 0);
86
- --card-foreground: oklch(0.985 0 0);
87
- --popover: oklch(0.205 0 0);
88
- --popover-foreground: oklch(0.985 0 0);
89
- /* 品牌主色 #17b3a3 (teal) —— 双模一致便于品牌识别 */
90
- --primary: oklch(0.7 0.12 183);
91
- --primary-foreground: oklch(0.985 0 0);
92
- --secondary: oklch(0.269 0 0);
93
- --secondary-foreground: oklch(0.985 0 0);
94
- --muted: oklch(0.269 0 0);
95
- --muted-foreground: oklch(0.708 0 0);
96
- --accent: oklch(0.269 0 0);
97
- --accent-foreground: oklch(0.985 0 0);
98
- --destructive: oklch(0.704 0.191 22.216);
99
- --border: oklch(1 0 0 / 10%);
100
- --input: oklch(1 0 0 / 15%);
101
- --ring: oklch(0.7 0.12 183);
102
- --chart-1: oklch(0.488 0.243 264.376);
103
- --chart-2: oklch(0.696 0.17 162.48);
104
- --chart-3: oklch(0.769 0.188 70.08);
105
- --chart-4: oklch(0.627 0.265 303.9);
106
- --chart-5: oklch(0.645 0.246 16.439);
107
- --sidebar: oklch(0.205 0 0);
108
- --sidebar-foreground: oklch(0.985 0 0);
109
- --sidebar-primary: oklch(0.7 0.12 183);
110
- --sidebar-primary-foreground: oklch(0.985 0 0);
111
- --sidebar-accent: oklch(0.269 0 0);
112
- --sidebar-accent-foreground: oklch(0.985 0 0);
113
- --sidebar-border: oklch(1 0 0 / 10%);
114
- --sidebar-ring: oklch(0.7 0.12 183);
115
- }
116
-
117
- @layer base {
118
- * {
119
- @apply border-border outline-ring/50;
120
- }
121
- body {
122
- @apply bg-background text-foreground;
123
- }
124
- }
1
+ @import "tw-animate-css";
2
+
3
+ /* Register this package's source files as Tailwind content sources. */
4
+ @source "./**/*.{ts,tsx}";
5
+
6
+ @custom-variant dark (&:is(.dark *));
7
+
8
+ @theme inline {
9
+ --color-background: var(--background);
10
+ --color-foreground: var(--foreground);
11
+ --color-sidebar-ring: var(--sidebar-ring);
12
+ --color-sidebar-border: var(--sidebar-border);
13
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
+ --color-sidebar-accent: var(--sidebar-accent);
15
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
+ --color-sidebar-primary: var(--sidebar-primary);
17
+ --color-sidebar-foreground: var(--sidebar-foreground);
18
+ --color-sidebar: var(--sidebar);
19
+ --color-chart-5: var(--chart-5);
20
+ --color-chart-4: var(--chart-4);
21
+ --color-chart-3: var(--chart-3);
22
+ --color-chart-2: var(--chart-2);
23
+ --color-chart-1: var(--chart-1);
24
+ --color-ring: var(--ring);
25
+ --color-input: var(--input);
26
+ --color-border: var(--border);
27
+ --color-destructive: var(--destructive);
28
+ --color-accent-foreground: var(--accent-foreground);
29
+ --color-accent: var(--accent);
30
+ --color-muted-foreground: var(--muted-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-secondary-foreground: var(--secondary-foreground);
33
+ --color-secondary: var(--secondary);
34
+ --color-primary-foreground: var(--primary-foreground);
35
+ --color-primary: var(--primary);
36
+ --color-popover-foreground: var(--popover-foreground);
37
+ --color-popover: var(--popover);
38
+ --color-card-foreground: var(--card-foreground);
39
+ --color-card: var(--card);
40
+ --radius-sm: calc(var(--radius) - 4px);
41
+ --radius-md: calc(var(--radius) - 2px);
42
+ --radius-lg: var(--radius);
43
+ --radius-xl: calc(var(--radius) + 4px);
44
+ }
45
+
46
+ :root {
47
+ --radius: 0.625rem;
48
+ --background: oklch(1 0 0);
49
+ --foreground: oklch(0.145 0 0);
50
+ --card: oklch(1 0 0);
51
+ --card-foreground: oklch(0.145 0 0);
52
+ --popover: oklch(1 0 0);
53
+ --popover-foreground: oklch(0.145 0 0);
54
+ /* 品牌主色 #17b3a3 (teal) */
55
+ --primary: oklch(0.7 0.12 183);
56
+ --primary-foreground: oklch(0.985 0 0);
57
+ --secondary: oklch(0.97 0 0);
58
+ --secondary-foreground: oklch(0.205 0 0);
59
+ --muted: oklch(0.97 0 0);
60
+ --muted-foreground: oklch(0.556 0 0);
61
+ --accent: oklch(0.97 0 0);
62
+ --accent-foreground: oklch(0.205 0 0);
63
+ --destructive: oklch(0.577 0.245 27.325);
64
+ --border: oklch(0.922 0 0);
65
+ --input: oklch(0.922 0 0);
66
+ --ring: oklch(0.7 0.12 183);
67
+ --chart-1: oklch(0.646 0.222 41.116);
68
+ --chart-2: oklch(0.6 0.118 184.704);
69
+ --chart-3: oklch(0.398 0.07 227.392);
70
+ --chart-4: oklch(0.828 0.189 84.429);
71
+ --chart-5: oklch(0.769 0.188 70.08);
72
+ --sidebar: oklch(0.985 0 0);
73
+ --sidebar-foreground: oklch(0.145 0 0);
74
+ --sidebar-primary: oklch(0.7 0.12 183);
75
+ --sidebar-primary-foreground: oklch(0.985 0 0);
76
+ --sidebar-accent: oklch(0.97 0 0);
77
+ --sidebar-accent-foreground: oklch(0.205 0 0);
78
+ --sidebar-border: oklch(0.922 0 0);
79
+ --sidebar-ring: oklch(0.7 0.12 183);
80
+ }
81
+
82
+ .dark {
83
+ --background: oklch(0.145 0 0);
84
+ --foreground: oklch(0.985 0 0);
85
+ --card: oklch(0.205 0 0);
86
+ --card-foreground: oklch(0.985 0 0);
87
+ --popover: oklch(0.205 0 0);
88
+ --popover-foreground: oklch(0.985 0 0);
89
+ /* 品牌主色 #17b3a3 (teal) —— 双模一致便于品牌识别 */
90
+ --primary: oklch(0.7 0.12 183);
91
+ --primary-foreground: oklch(0.985 0 0);
92
+ --secondary: oklch(0.269 0 0);
93
+ --secondary-foreground: oklch(0.985 0 0);
94
+ --muted: oklch(0.269 0 0);
95
+ --muted-foreground: oklch(0.708 0 0);
96
+ --accent: oklch(0.269 0 0);
97
+ --accent-foreground: oklch(0.985 0 0);
98
+ --destructive: oklch(0.704 0.191 22.216);
99
+ --border: oklch(1 0 0 / 10%);
100
+ --input: oklch(1 0 0 / 15%);
101
+ --ring: oklch(0.7 0.12 183);
102
+ --chart-1: oklch(0.488 0.243 264.376);
103
+ --chart-2: oklch(0.696 0.17 162.48);
104
+ --chart-3: oklch(0.769 0.188 70.08);
105
+ --chart-4: oklch(0.627 0.265 303.9);
106
+ --chart-5: oklch(0.645 0.246 16.439);
107
+ --sidebar: oklch(0.205 0 0);
108
+ --sidebar-foreground: oklch(0.985 0 0);
109
+ --sidebar-primary: oklch(0.7 0.12 183);
110
+ --sidebar-primary-foreground: oklch(0.985 0 0);
111
+ --sidebar-accent: oklch(0.269 0 0);
112
+ --sidebar-accent-foreground: oklch(0.985 0 0);
113
+ --sidebar-border: oklch(1 0 0 / 10%);
114
+ --sidebar-ring: oklch(0.7 0.12 183);
115
+ }
116
+
117
+ @layer base {
118
+ * {
119
+ @apply border-border outline-ring/50;
120
+ }
121
+ body {
122
+ @apply bg-background text-foreground;
123
+ }
124
+ }
@@ -1,141 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- Accordion,
5
- AccordionContent,
6
- AccordionItem,
7
- AccordionTrigger,
8
- } from "../ui/accordion";
9
- import { Badge } from "../ui/badge";
10
- import { cn } from "../../lib/utils";
11
- import type { Tool } from "ai";
12
- import { BotIcon } from "lucide-react";
13
- import type { ComponentProps } from "react";
14
- import { memo } from "react";
15
-
16
- import { CodeBlock } from "./code-block";
17
-
18
- export type AgentProps = ComponentProps<"div">;
19
-
20
- export const Agent = memo(({ className, ...props }: AgentProps) => (
21
- <div
22
- className={cn("not-prose w-full rounded-md border", className)}
23
- {...props}
24
- />
25
- ));
26
-
27
- export type AgentHeaderProps = ComponentProps<"div"> & {
28
- name: string;
29
- model?: string;
30
- };
31
-
32
- export const AgentHeader = memo(
33
- ({ className, name, model, ...props }: AgentHeaderProps) => (
34
- <div
35
- className={cn(
36
- "flex w-full items-center justify-between gap-4 p-3",
37
- className
38
- )}
39
- {...props}
40
- >
41
- <div className="flex items-center gap-2">
42
- <BotIcon className="size-4 text-muted-foreground" />
43
- <span className="font-medium text-sm">{name}</span>
44
- {model && (
45
- <Badge className="font-mono text-xs" variant="secondary">
46
- {model}
47
- </Badge>
48
- )}
49
- </div>
50
- </div>
51
- )
52
- );
53
-
54
- export type AgentContentProps = ComponentProps<"div">;
55
-
56
- export const AgentContent = memo(
57
- ({ className, ...props }: AgentContentProps) => (
58
- <div className={cn("space-y-4 p-4 pt-0", className)} {...props} />
59
- )
60
- );
61
-
62
- export type AgentInstructionsProps = ComponentProps<"div"> & {
63
- children: string;
64
- };
65
-
66
- export const AgentInstructions = memo(
67
- ({ className, children, ...props }: AgentInstructionsProps) => (
68
- <div className={cn("space-y-2", className)} {...props}>
69
- <span className="font-medium text-muted-foreground text-sm">
70
- Instructions
71
- </span>
72
- <div className="rounded-md bg-muted/50 p-3 text-muted-foreground text-sm">
73
- <p>{children}</p>
74
- </div>
75
- </div>
76
- )
77
- );
78
-
79
- export type AgentToolsProps = ComponentProps<typeof Accordion>;
80
-
81
- export const AgentTools = memo(({ className, ...props }: AgentToolsProps) => (
82
- <div className={cn("space-y-2", className)}>
83
- <span className="font-medium text-muted-foreground text-sm">Tools</span>
84
- <Accordion className="rounded-md border" {...props} />
85
- </div>
86
- ));
87
-
88
- export type AgentToolProps = ComponentProps<typeof AccordionItem> & {
89
- tool: Tool;
90
- };
91
-
92
- export const AgentTool = memo(
93
- ({ className, tool, value, ...props }: AgentToolProps) => {
94
- const schema =
95
- "jsonSchema" in tool && tool.jsonSchema
96
- ? tool.jsonSchema
97
- : tool.inputSchema;
98
-
99
- return (
100
- <AccordionItem
101
- className={cn("border-b last:border-b-0", className)}
102
- value={value}
103
- {...props}
104
- >
105
- <AccordionTrigger className="px-3 py-2 text-sm hover:no-underline">
106
- {tool.description ?? "No description"}
107
- </AccordionTrigger>
108
- <AccordionContent className="px-3 pb-3">
109
- <div className="rounded-md bg-muted/50">
110
- <CodeBlock code={JSON.stringify(schema, null, 2)} language="json" />
111
- </div>
112
- </AccordionContent>
113
- </AccordionItem>
114
- );
115
- }
116
- );
117
-
118
- export type AgentOutputProps = ComponentProps<"div"> & {
119
- schema: string;
120
- };
121
-
122
- export const AgentOutput = memo(
123
- ({ className, schema, ...props }: AgentOutputProps) => (
124
- <div className={cn("space-y-2", className)} {...props}>
125
- <span className="font-medium text-muted-foreground text-sm">
126
- Output Schema
127
- </span>
128
- <div className="rounded-md bg-muted/50">
129
- <CodeBlock code={schema} language="typescript" />
130
- </div>
131
- </div>
132
- )
133
- );
134
-
135
- Agent.displayName = "Agent";
136
- AgentHeader.displayName = "AgentHeader";
137
- AgentContent.displayName = "AgentContent";
138
- AgentInstructions.displayName = "AgentInstructions";
139
- AgentTools.displayName = "AgentTools";
140
- AgentTool.displayName = "AgentTool";
141
- AgentOutput.displayName = "AgentOutput";
@@ -1,148 +0,0 @@
1
- "use client";
2
-
3
- import { Button } from "../ui/button";
4
- import {
5
- Tooltip,
6
- TooltipContent,
7
- TooltipProvider,
8
- TooltipTrigger,
9
- } from "../ui/tooltip";
10
- import { cn } from "../../lib/utils";
11
- import type { LucideIcon } from "lucide-react";
12
- import { XIcon } from "lucide-react";
13
- import type { ComponentProps, HTMLAttributes } from "react";
14
-
15
- export type ArtifactProps = HTMLAttributes<HTMLDivElement>;
16
-
17
- export const Artifact = ({ className, ...props }: ArtifactProps) => (
18
- <div
19
- className={cn(
20
- "flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",
21
- className
22
- )}
23
- {...props}
24
- />
25
- );
26
-
27
- export type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;
28
-
29
- export const ArtifactHeader = ({
30
- className,
31
- ...props
32
- }: ArtifactHeaderProps) => (
33
- <div
34
- className={cn(
35
- "flex items-center justify-between border-b bg-muted/50 px-4 py-3",
36
- className
37
- )}
38
- {...props}
39
- />
40
- );
41
-
42
- export type ArtifactCloseProps = ComponentProps<typeof Button>;
43
-
44
- export const ArtifactClose = ({
45
- className,
46
- children,
47
- size = "sm",
48
- variant = "ghost",
49
- ...props
50
- }: ArtifactCloseProps) => (
51
- <Button
52
- className={cn(
53
- "size-8 p-0 text-muted-foreground hover:text-foreground",
54
- className
55
- )}
56
- size={size}
57
- type="button"
58
- variant={variant}
59
- {...props}
60
- >
61
- {children ?? <XIcon className="size-4" />}
62
- <span className="sr-only">Close</span>
63
- </Button>
64
- );
65
-
66
- export type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;
67
-
68
- export const ArtifactTitle = ({ className, ...props }: ArtifactTitleProps) => (
69
- <p
70
- className={cn("font-medium text-foreground text-sm", className)}
71
- {...props}
72
- />
73
- );
74
-
75
- export type ArtifactDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
76
-
77
- export const ArtifactDescription = ({
78
- className,
79
- ...props
80
- }: ArtifactDescriptionProps) => (
81
- <p className={cn("text-muted-foreground text-sm", className)} {...props} />
82
- );
83
-
84
- export type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;
85
-
86
- export const ArtifactActions = ({
87
- className,
88
- ...props
89
- }: ArtifactActionsProps) => (
90
- <div className={cn("flex items-center gap-1", className)} {...props} />
91
- );
92
-
93
- export type ArtifactActionProps = ComponentProps<typeof Button> & {
94
- tooltip?: string;
95
- label?: string;
96
- icon?: LucideIcon;
97
- };
98
-
99
- export const ArtifactAction = ({
100
- tooltip,
101
- label,
102
- icon: Icon,
103
- children,
104
- className,
105
- size = "sm",
106
- variant = "ghost",
107
- ...props
108
- }: ArtifactActionProps) => {
109
- const button = (
110
- <Button
111
- className={cn(
112
- "size-8 p-0 text-muted-foreground hover:text-foreground",
113
- className
114
- )}
115
- size={size}
116
- type="button"
117
- variant={variant}
118
- {...props}
119
- >
120
- {Icon ? <Icon className="size-4" /> : children}
121
- <span className="sr-only">{label || tooltip}</span>
122
- </Button>
123
- );
124
-
125
- if (tooltip) {
126
- return (
127
- <TooltipProvider>
128
- <Tooltip>
129
- <TooltipTrigger asChild>{button}</TooltipTrigger>
130
- <TooltipContent>
131
- <p>{tooltip}</p>
132
- </TooltipContent>
133
- </Tooltip>
134
- </TooltipProvider>
135
- );
136
- }
137
-
138
- return button;
139
- };
140
-
141
- export type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;
142
-
143
- export const ArtifactContent = ({
144
- className,
145
- ...props
146
- }: ArtifactContentProps) => (
147
- <div className={cn("flex-1 overflow-auto p-4", className)} {...props} />
148
- );