@chat-js/cli 0.6.1 → 0.6.2

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 (153) hide show
  1. package/dist/index.js +16938 -16786
  2. package/package.json +1 -1
  3. package/templates/chat-app/app/(auth)/login/page.tsx +3 -3
  4. package/templates/chat-app/app/(chat)/api/chat/route.ts +4 -60
  5. package/templates/chat-app/app/not-found.tsx +2 -2
  6. package/templates/chat-app/chat.config.ts +3 -0
  7. package/templates/chat-app/components/ai-elements/actions.tsx +44 -44
  8. package/templates/chat-app/components/ai-elements/artifact.tsx +92 -92
  9. package/templates/chat-app/components/ai-elements/code-block.tsx +143 -143
  10. package/templates/chat-app/components/ai-elements/context.tsx +313 -313
  11. package/templates/chat-app/components/ai-elements/conversation.tsx +65 -65
  12. package/templates/chat-app/components/ai-elements/extra/conversation-content-scroll-area.tsx +29 -29
  13. package/templates/chat-app/components/ai-elements/extra/mcp-tool-header.tsx +27 -27
  14. package/templates/chat-app/components/ai-elements/message.tsx +341 -344
  15. package/templates/chat-app/components/ai-elements/parseIncompleteMarkdown.tsx +122 -122
  16. package/templates/chat-app/components/ai-elements/prompt-input.tsx +1059 -1059
  17. package/templates/chat-app/components/ai-elements/reasoning.tsx +131 -131
  18. package/templates/chat-app/components/ai-elements/response.tsx +15 -12
  19. package/templates/chat-app/components/ai-elements/sandbox.tsx +84 -84
  20. package/templates/chat-app/components/ai-elements/shimmer.tsx +47 -47
  21. package/templates/chat-app/components/ai-elements/suggestion.tsx +33 -33
  22. package/templates/chat-app/components/ai-elements/tool.tsx +118 -118
  23. package/templates/chat-app/components/app-sidebar-history-conditional.tsx +3 -3
  24. package/templates/chat-app/components/app-sidebar.tsx +3 -3
  25. package/templates/chat-app/components/connectors-dropdown.tsx +6 -3
  26. package/templates/chat-app/components/deep-research-progress.tsx +1 -1
  27. package/templates/chat-app/components/header-breadcrumb.tsx +14 -11
  28. package/templates/chat-app/components/internal-link.tsx +73 -0
  29. package/templates/chat-app/components/login-form.tsx +5 -5
  30. package/templates/chat-app/components/message-parts.tsx +1 -71
  31. package/templates/chat-app/components/model-selector.tsx +3 -3
  32. package/templates/chat-app/components/new-chat-button.tsx +4 -4
  33. package/templates/chat-app/components/part/document-common.tsx +3 -3
  34. package/templates/chat-app/components/part/document-tool.tsx +3 -3
  35. package/templates/chat-app/components/part/message-annotations.tsx +2 -2
  36. package/templates/chat-app/components/part/tool-part.tsx +92 -0
  37. package/templates/chat-app/components/project-chat-item.tsx +2 -2
  38. package/templates/chat-app/components/research-progress.tsx +2 -2
  39. package/templates/chat-app/components/research-task.tsx +1 -1
  40. package/templates/chat-app/components/research-tasks.tsx +1 -1
  41. package/templates/chat-app/components/settings/connectors-settings.tsx +4 -4
  42. package/templates/chat-app/components/settings/mcp-details-page.tsx +5 -5
  43. package/templates/chat-app/components/settings/settings-nav.tsx +3 -3
  44. package/templates/chat-app/components/sidebar-chat-item.tsx +4 -12
  45. package/templates/chat-app/components/sidebar-project-item.tsx +4 -11
  46. package/templates/chat-app/components/sidebar-top-row.tsx +7 -7
  47. package/templates/chat-app/components/sidebar-user-nav.tsx +3 -3
  48. package/templates/chat-app/components/signup-form.tsx +8 -5
  49. package/templates/chat-app/components/source-badge.tsx +3 -9
  50. package/templates/chat-app/components/sources.tsx +1 -1
  51. package/templates/chat-app/components/ui/accordion.tsx +32 -32
  52. package/templates/chat-app/components/ui/alert-dialog.tsx +103 -103
  53. package/templates/chat-app/components/ui/alert.tsx +36 -36
  54. package/templates/chat-app/components/ui/avatar.tsx +28 -28
  55. package/templates/chat-app/components/ui/badge.tsx +22 -22
  56. package/templates/chat-app/components/ui/breadcrumb.tsx +72 -72
  57. package/templates/chat-app/components/ui/button-group.tsx +58 -58
  58. package/templates/chat-app/components/ui/button.tsx +45 -45
  59. package/templates/chat-app/components/ui/card.tsx +65 -65
  60. package/templates/chat-app/components/ui/checkbox.tsx +16 -16
  61. package/templates/chat-app/components/ui/collapsible.tsx +1 -1
  62. package/templates/chat-app/components/ui/command.tsx +137 -137
  63. package/templates/chat-app/components/ui/dialog.tsx +94 -94
  64. package/templates/chat-app/components/ui/drawer.tsx +68 -68
  65. package/templates/chat-app/components/ui/dropdown-menu.tsx +184 -184
  66. package/templates/chat-app/components/ui/empty.tsx +76 -76
  67. package/templates/chat-app/components/ui/extra/action-container.tsx +3 -3
  68. package/templates/chat-app/components/ui/extra/scroll-area-viewport-ref.tsx +24 -24
  69. package/templates/chat-app/components/ui/form.tsx +112 -112
  70. package/templates/chat-app/components/ui/hover-card.tsx +25 -25
  71. package/templates/chat-app/components/ui/input-group.tsx +126 -126
  72. package/templates/chat-app/components/ui/input.tsx +13 -13
  73. package/templates/chat-app/components/ui/label.tsx +12 -12
  74. package/templates/chat-app/components/ui/popover.tsx +25 -25
  75. package/templates/chat-app/components/ui/progress.tsx +19 -19
  76. package/templates/chat-app/components/ui/resizable.tsx +27 -27
  77. package/templates/chat-app/components/ui/scroll-area.tsx +30 -30
  78. package/templates/chat-app/components/ui/select.tsx +108 -108
  79. package/templates/chat-app/components/ui/separator.tsx +16 -16
  80. package/templates/chat-app/components/ui/sheet.tsx +91 -91
  81. package/templates/chat-app/components/ui/sidebar.tsx +615 -615
  82. package/templates/chat-app/components/ui/skeleton.tsx +7 -7
  83. package/templates/chat-app/components/ui/slider.tsx +50 -50
  84. package/templates/chat-app/components/ui/spinner.tsx +8 -8
  85. package/templates/chat-app/components/ui/switch.tsx +16 -16
  86. package/templates/chat-app/components/ui/table.tsx +71 -71
  87. package/templates/chat-app/components/ui/tabs.tsx +31 -31
  88. package/templates/chat-app/components/ui/textarea.tsx +10 -10
  89. package/templates/chat-app/components/ui/toggle.tsx +31 -31
  90. package/templates/chat-app/components/ui/tooltip.tsx +48 -48
  91. package/templates/chat-app/components/upgrade-cta/limit-display.tsx +7 -7
  92. package/templates/chat-app/components/upgrade-cta/login-cta-banner.tsx +3 -3
  93. package/templates/chat-app/components/upgrade-cta/login-prompt.tsx +3 -3
  94. package/templates/chat-app/hooks/use-mobile.ts +13 -13
  95. package/templates/chat-app/lib/ai/core-chat-agent.ts +25 -14
  96. package/templates/chat-app/lib/ai/eval-agent.ts +4 -5
  97. package/templates/chat-app/lib/ai/installed-tools.ts +12 -0
  98. package/templates/chat-app/lib/ai/mcp/mcp-client.ts +2 -2
  99. package/templates/chat-app/lib/ai/models.generated.ts +4236 -4585
  100. package/templates/chat-app/lib/ai/tool-renderer-registry.ts +31 -0
  101. package/templates/chat-app/lib/ai/types.ts +15 -20
  102. package/templates/chat-app/lib/config-requirements.ts +11 -6
  103. package/templates/chat-app/lib/config-schema.ts +13 -0
  104. package/templates/chat-app/lib/stores/hooks-message-parts.ts +1 -1
  105. package/templates/chat-app/lib/utils.ts +157 -157
  106. package/templates/chat-app/package.json +1 -1
  107. package/templates/chat-app/scripts/check-env.ts +229 -2
  108. package/templates/chat-app/tools/chatjs/_shared/lib/tool-part.ts +5 -0
  109. package/templates/chat-app/{components/part/weather.tsx → tools/chatjs/get-weather/renderer.tsx} +24 -38
  110. package/templates/chat-app/{components/part/retrieve-url.tsx → tools/chatjs/retrieve-url/renderer.tsx} +20 -15
  111. package/templates/chat-app/{lib/ai/tools/retrieve-url.ts → tools/chatjs/retrieve-url/tool.ts} +46 -7
  112. package/templates/chat-app/tools/chatjs/tools.ts +16 -0
  113. package/templates/chat-app/tools/chatjs/ui.ts +17 -0
  114. package/templates/chat-app/tools/chatjs/word-count/renderer.tsx +50 -0
  115. package/templates/chat-app/tools/chatjs/word-count/tool.ts +30 -0
  116. package/templates/chat-app/{lib/ai/tools → tools/platform}/code-execution.ts +3 -5
  117. package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/deep-research.ts +2 -3
  118. package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/pipeline.ts +1 -1
  119. package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/types.ts +1 -1
  120. package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/utils.ts +7 -7
  121. package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/types.ts +1 -1
  122. package/templates/chat-app/{lib/ai/tools → tools/platform}/generate-video.ts +4 -6
  123. package/templates/chat-app/{lib/ai/tools → tools/platform}/read-document.ts +2 -2
  124. package/templates/chat-app/{lib/ai/tools → tools/platform}/steps/multi-query-web-search.ts +1 -1
  125. package/templates/chat-app/{lib/ai/tools → tools/platform}/steps/web-search.ts +1 -1
  126. package/templates/chat-app/{lib/ai/tools → tools/platform}/tools.ts +20 -20
  127. package/templates/chat-app/{lib/ai/tools → tools/platform}/web-search.ts +7 -5
  128. package/templates/electron/CHANGELOG.md +7 -1
  129. package/templates/electron/package.json +1 -1
  130. package/templates/chat-app/lib/ai/tools/tools-definitions.ts +0 -83
  131. /package/templates/chat-app/{lib/ai/tools/get-weather.ts → tools/chatjs/get-weather/tool.ts} +0 -0
  132. /package/templates/chat-app/{lib/ai/tools → tools/platform}/code-execution.javascript.ts +0 -0
  133. /package/templates/chat-app/{lib/ai/tools → tools/platform}/code-execution.python.ts +0 -0
  134. /package/templates/chat-app/{lib/ai/tools → tools/platform}/code-execution.shared.test.ts +0 -0
  135. /package/templates/chat-app/{lib/ai/tools → tools/platform}/code-execution.shared.ts +0 -0
  136. /package/templates/chat-app/{lib/ai/tools → tools/platform}/code-execution.types.ts +0 -0
  137. /package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/configuration.ts +0 -0
  138. /package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/prompts.ts +0 -0
  139. /package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/researcher-agent.ts +0 -0
  140. /package/templates/chat-app/{lib/ai/tools → tools/platform}/deep-research/supervisor-agent.ts +0 -0
  141. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/code-guidelines.ts +0 -0
  142. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/create-code-document.ts +0 -0
  143. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/create-sheet-document.ts +0 -0
  144. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/create-text-document.ts +0 -0
  145. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/edit-code-document.ts +0 -0
  146. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/edit-sheet-document.ts +0 -0
  147. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/edit-text-document.ts +0 -0
  148. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/sheet-guidelines.ts +0 -0
  149. /package/templates/chat-app/{lib/ai/tools → tools/platform}/documents/text-guidelines.ts +0 -0
  150. /package/templates/chat-app/{lib/ai/tools → tools/platform}/generate-image.ts +0 -0
  151. /package/templates/chat-app/{lib/ai/tools → tools/platform}/research-updates-schema.ts +0 -0
  152. /package/templates/chat-app/{lib/ai/tools → tools/platform}/steps/search-utils.ts +0 -0
  153. /package/templates/chat-app/{lib/ai/tools → tools/platform}/types.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
 
3
- import Link from "next/link";
4
3
  import { useSearchParams } from "next/navigation";
5
4
  import { Suspense, useEffect, useState } from "react";
6
5
  import { SocialAuthProviders } from "@/components/auth-providers";
6
+ import { InternalLink } from "@/components/internal-link";
7
7
  import {
8
8
  Card,
9
9
  CardContent,
@@ -64,9 +64,12 @@ export function SignupForm({
64
64
  ) : (
65
65
  <div className="text-center text-sm">
66
66
  Already have an account?{" "}
67
- <Link className="underline underline-offset-4" href={loginHref}>
67
+ <InternalLink
68
+ className="underline underline-offset-4"
69
+ href={loginHref}
70
+ >
68
71
  Sign in
69
- </Link>
72
+ </InternalLink>
70
73
  </div>
71
74
  )}
72
75
  </div>
@@ -74,8 +77,8 @@ export function SignupForm({
74
77
  </Card>
75
78
  <div className="text-balance text-center text-muted-foreground text-xs [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary">
76
79
  By clicking continue, you agree to our{" "}
77
- <Link href="/terms">Terms of Service</Link> and{" "}
78
- <Link href="/privacy">Privacy Policy</Link>.
80
+ <InternalLink href="/terms">Terms of Service</InternalLink> and{" "}
81
+ <InternalLink href="/privacy">Privacy Policy</InternalLink>.
79
82
  </div>
80
83
  </div>
81
84
  );
@@ -1,24 +1,18 @@
1
- import Link from "next/link";
2
1
  import { Badge } from "@/components/ui/badge";
3
2
  import {
4
3
  Tooltip,
5
4
  TooltipContent,
6
5
  TooltipTrigger,
7
6
  } from "@/components/ui/tooltip";
8
- import type { SearchResultItem } from "@/lib/ai/tools/research-updates-schema";
9
7
  import { getDomainFromUrl, getFaviconUrl } from "@/lib/url-utils";
8
+ import type { SearchResultItem } from "@/tools/platform/research-updates-schema";
10
9
  import { Favicon } from "./favicon";
11
10
 
12
11
  export function WebSourceBadge({ result }: { result: SearchResultItem }) {
13
12
  return (
14
13
  <Tooltip>
15
14
  <TooltipTrigger asChild>
16
- <Link
17
- // @ts-expect-error - result.url is a valid URL
18
- href={result.url}
19
- rel="noopener noreferrer"
20
- target="_blank"
21
- >
15
+ <a href={result.url} rel="noopener noreferrer" target="_blank">
22
16
  <Badge
23
17
  className="max-w-[200px] gap-1 truncate text-xs"
24
18
  variant="secondary"
@@ -29,7 +23,7 @@ export function WebSourceBadge({ result }: { result: SearchResultItem }) {
29
23
  {result.title}
30
24
  </span>
31
25
  </Badge>
32
- </Link>
26
+ </a>
33
27
  </TooltipTrigger>
34
28
  <TooltipContent className="max-w-xs space-y-1 p-3" variant="base">
35
29
  <div className="flex items-center gap-2">
@@ -14,9 +14,9 @@ import {
14
14
  DrawerTrigger,
15
15
  } from "@/components/ui/drawer";
16
16
  import { useMediaQuery } from "@/hooks/use-media-query";
17
- import type { SearchResultItem } from "@/lib/ai/tools/research-updates-schema";
18
17
  import { getFaviconUrl } from "@/lib/url-utils";
19
18
  import { cn } from "@/lib/utils";
19
+ import type { SearchResultItem } from "@/tools/platform/research-updates-schema";
20
20
  import { Favicon } from "./favicon";
21
21
  import { FaviconGroup } from "./favicon-group";
22
22
 
@@ -9,50 +9,50 @@ import { cn } from "@/lib/utils";
9
9
  const Accordion = AccordionPrimitive.Root;
10
10
 
11
11
  const AccordionItem = React.forwardRef<
12
- React.ElementRef<typeof AccordionPrimitive.Item>,
13
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
12
+ React.ElementRef<typeof AccordionPrimitive.Item>,
13
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
14
14
  >(({ className, ...props }, ref) => (
15
- <AccordionPrimitive.Item
16
- className={cn("border-b", className)}
17
- ref={ref}
18
- {...props}
19
- />
15
+ <AccordionPrimitive.Item
16
+ className={cn("border-b", className)}
17
+ ref={ref}
18
+ {...props}
19
+ />
20
20
  ));
21
21
  AccordionItem.displayName = "AccordionItem";
22
22
 
23
23
  const AccordionTrigger = React.forwardRef<
24
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
25
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
24
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
25
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
26
26
  >(({ className, children, ...props }, ref) => (
27
- <AccordionPrimitive.Header className="flex">
28
- <AccordionPrimitive.Trigger
29
- className={cn(
30
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
31
- className
32
- )}
33
- ref={ref}
34
- {...props}
35
- >
36
- {children}
37
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
38
- </AccordionPrimitive.Trigger>
39
- </AccordionPrimitive.Header>
27
+ <AccordionPrimitive.Header className="flex">
28
+ <AccordionPrimitive.Trigger
29
+ className={cn(
30
+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
31
+ className,
32
+ )}
33
+ ref={ref}
34
+ {...props}
35
+ >
36
+ {children}
37
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
38
+ </AccordionPrimitive.Trigger>
39
+ </AccordionPrimitive.Header>
40
40
  ));
41
41
  AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
42
42
 
43
43
  const AccordionContent = React.forwardRef<
44
- React.ElementRef<typeof AccordionPrimitive.Content>,
45
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
44
+ React.ElementRef<typeof AccordionPrimitive.Content>,
45
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
46
46
  >(({ className, children, ...props }, ref) => (
47
- <AccordionPrimitive.Content
48
- className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
49
- ref={ref}
50
- {...props}
51
- >
52
- <div className={cn("pt-0 pb-4", className)}>{children}</div>
53
- </AccordionPrimitive.Content>
47
+ <AccordionPrimitive.Content
48
+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
49
+ ref={ref}
50
+ {...props}
51
+ >
52
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
53
+ </AccordionPrimitive.Content>
54
54
  ));
55
55
 
56
56
  AccordionContent.displayName = AccordionPrimitive.Content.displayName;
57
57
 
58
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
58
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -6,151 +6,151 @@ import { buttonVariants } from "@/components/ui/button";
6
6
  import { cn } from "@/lib/utils";
7
7
 
8
8
  function AlertDialog({
9
- ...props
9
+ ...props
10
10
  }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
11
- return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
11
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
12
12
  }
13
13
 
14
14
  function AlertDialogTrigger({
15
- ...props
15
+ ...props
16
16
  }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
17
- return (
18
- <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
19
- );
17
+ return (
18
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
19
+ );
20
20
  }
21
21
 
22
22
  function AlertDialogPortal({
23
- ...props
23
+ ...props
24
24
  }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
25
- return (
26
- <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
27
- );
25
+ return (
26
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
27
+ );
28
28
  }
29
29
 
30
30
  function AlertDialogOverlay({
31
- className,
32
- ...props
31
+ className,
32
+ ...props
33
33
  }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
34
- return (
35
- <AlertDialogPrimitive.Overlay
36
- className={cn(
37
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
38
- className
39
- )}
40
- data-slot="alert-dialog-overlay"
41
- {...props}
42
- />
43
- );
34
+ return (
35
+ <AlertDialogPrimitive.Overlay
36
+ className={cn(
37
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
38
+ className,
39
+ )}
40
+ data-slot="alert-dialog-overlay"
41
+ {...props}
42
+ />
43
+ );
44
44
  }
45
45
 
46
46
  function AlertDialogContent({
47
- className,
48
- ...props
47
+ className,
48
+ ...props
49
49
  }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
50
- return (
51
- <AlertDialogPortal>
52
- <AlertDialogOverlay />
53
- <AlertDialogPrimitive.Content
54
- className={cn(
55
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
56
- className
57
- )}
58
- data-slot="alert-dialog-content"
59
- {...props}
60
- />
61
- </AlertDialogPortal>
62
- );
50
+ return (
51
+ <AlertDialogPortal>
52
+ <AlertDialogOverlay />
53
+ <AlertDialogPrimitive.Content
54
+ className={cn(
55
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
56
+ className,
57
+ )}
58
+ data-slot="alert-dialog-content"
59
+ {...props}
60
+ />
61
+ </AlertDialogPortal>
62
+ );
63
63
  }
64
64
 
65
65
  function AlertDialogHeader({
66
- className,
67
- ...props
66
+ className,
67
+ ...props
68
68
  }: React.ComponentProps<"div">) {
69
- return (
70
- <div
71
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
72
- data-slot="alert-dialog-header"
73
- {...props}
74
- />
75
- );
69
+ return (
70
+ <div
71
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
72
+ data-slot="alert-dialog-header"
73
+ {...props}
74
+ />
75
+ );
76
76
  }
77
77
 
78
78
  function AlertDialogFooter({
79
- className,
80
- ...props
79
+ className,
80
+ ...props
81
81
  }: React.ComponentProps<"div">) {
82
- return (
83
- <div
84
- className={cn(
85
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
86
- className
87
- )}
88
- data-slot="alert-dialog-footer"
89
- {...props}
90
- />
91
- );
82
+ return (
83
+ <div
84
+ className={cn(
85
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
86
+ className,
87
+ )}
88
+ data-slot="alert-dialog-footer"
89
+ {...props}
90
+ />
91
+ );
92
92
  }
93
93
 
94
94
  function AlertDialogTitle({
95
- className,
96
- ...props
95
+ className,
96
+ ...props
97
97
  }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
98
- return (
99
- <AlertDialogPrimitive.Title
100
- className={cn("font-semibold text-lg", className)}
101
- data-slot="alert-dialog-title"
102
- {...props}
103
- />
104
- );
98
+ return (
99
+ <AlertDialogPrimitive.Title
100
+ className={cn("font-semibold text-lg", className)}
101
+ data-slot="alert-dialog-title"
102
+ {...props}
103
+ />
104
+ );
105
105
  }
106
106
 
107
107
  function AlertDialogDescription({
108
- className,
109
- ...props
108
+ className,
109
+ ...props
110
110
  }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
111
- return (
112
- <AlertDialogPrimitive.Description
113
- className={cn("text-muted-foreground text-sm", className)}
114
- data-slot="alert-dialog-description"
115
- {...props}
116
- />
117
- );
111
+ return (
112
+ <AlertDialogPrimitive.Description
113
+ className={cn("text-muted-foreground text-sm", className)}
114
+ data-slot="alert-dialog-description"
115
+ {...props}
116
+ />
117
+ );
118
118
  }
119
119
 
120
120
  function AlertDialogAction({
121
- className,
122
- ...props
121
+ className,
122
+ ...props
123
123
  }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
124
- return (
125
- <AlertDialogPrimitive.Action
126
- className={cn(buttonVariants(), className)}
127
- {...props}
128
- />
129
- );
124
+ return (
125
+ <AlertDialogPrimitive.Action
126
+ className={cn(buttonVariants(), className)}
127
+ {...props}
128
+ />
129
+ );
130
130
  }
131
131
 
132
132
  function AlertDialogCancel({
133
- className,
134
- ...props
133
+ className,
134
+ ...props
135
135
  }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
136
- return (
137
- <AlertDialogPrimitive.Cancel
138
- className={cn(buttonVariants({ variant: "outline" }), className)}
139
- {...props}
140
- />
141
- );
136
+ return (
137
+ <AlertDialogPrimitive.Cancel
138
+ className={cn(buttonVariants({ variant: "outline" }), className)}
139
+ {...props}
140
+ />
141
+ );
142
142
  }
143
143
 
144
144
  export {
145
- AlertDialog,
146
- AlertDialogPortal,
147
- AlertDialogOverlay,
148
- AlertDialogTrigger,
149
- AlertDialogContent,
150
- AlertDialogHeader,
151
- AlertDialogFooter,
152
- AlertDialogTitle,
153
- AlertDialogDescription,
154
- AlertDialogAction,
155
- AlertDialogCancel,
145
+ AlertDialog,
146
+ AlertDialogAction,
147
+ AlertDialogCancel,
148
+ AlertDialogContent,
149
+ AlertDialogDescription,
150
+ AlertDialogFooter,
151
+ AlertDialogHeader,
152
+ AlertDialogOverlay,
153
+ AlertDialogPortal,
154
+ AlertDialogTitle,
155
+ AlertDialogTrigger,
156
156
  };
@@ -4,56 +4,56 @@ import * as React from "react";
4
4
  import { cn } from "@/lib/utils";
5
5
 
6
6
  const alertVariants = cva(
7
- "relative w-full rounded-lg border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:top-4 [&>svg]:left-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
- }
7
+ "relative w-full rounded-lg border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:top-4 [&>svg]:left-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
20
  );
21
21
 
22
22
  const Alert = React.forwardRef<
23
- HTMLDivElement,
24
- React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
23
+ HTMLDivElement,
24
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
25
25
  >(({ className, variant, ...props }, ref) => (
26
- <div
27
- className={cn(alertVariants({ variant }), className)}
28
- ref={ref}
29
- role="alert"
30
- {...props}
31
- />
26
+ <div
27
+ className={cn(alertVariants({ variant }), className)}
28
+ ref={ref}
29
+ role="alert"
30
+ {...props}
31
+ />
32
32
  ));
33
33
  Alert.displayName = "Alert";
34
34
 
35
35
  const AlertTitle = React.forwardRef<
36
- HTMLParagraphElement,
37
- React.HTMLAttributes<HTMLHeadingElement>
36
+ HTMLParagraphElement,
37
+ React.HTMLAttributes<HTMLHeadingElement>
38
38
  >(({ className, ...props }, ref) => (
39
- <h5
40
- className={cn("mb-1 font-medium leading-none tracking-tight", className)}
41
- ref={ref}
42
- {...props}
43
- />
39
+ <h5
40
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
41
+ ref={ref}
42
+ {...props}
43
+ />
44
44
  ));
45
45
  AlertTitle.displayName = "AlertTitle";
46
46
 
47
47
  const AlertDescription = React.forwardRef<
48
- HTMLParagraphElement,
49
- React.HTMLAttributes<HTMLParagraphElement>
48
+ HTMLParagraphElement,
49
+ React.HTMLAttributes<HTMLParagraphElement>
50
50
  >(({ className, ...props }, ref) => (
51
- <div
52
- className={cn("text-sm [&_p]:leading-relaxed", className)}
53
- ref={ref}
54
- {...props}
55
- />
51
+ <div
52
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
53
+ ref={ref}
54
+ {...props}
55
+ />
56
56
  ));
57
57
  AlertDescription.displayName = "AlertDescription";
58
58
 
59
- export { Alert, AlertTitle, AlertDescription };
59
+ export { Alert, AlertDescription, AlertTitle };
@@ -6,45 +6,45 @@ import * as React from "react";
6
6
  import { cn } from "@/lib/utils";
7
7
 
8
8
  const Avatar = React.forwardRef<
9
- React.ElementRef<typeof AvatarPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
9
+ React.ElementRef<typeof AvatarPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
11
11
  >(({ className, ...props }, ref) => (
12
- <AvatarPrimitive.Root
13
- className={cn(
14
- "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
15
- className
16
- )}
17
- ref={ref}
18
- {...props}
19
- />
12
+ <AvatarPrimitive.Root
13
+ className={cn(
14
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
15
+ className,
16
+ )}
17
+ ref={ref}
18
+ {...props}
19
+ />
20
20
  ));
21
21
  Avatar.displayName = AvatarPrimitive.Root.displayName;
22
22
 
23
23
  const AvatarImage = React.forwardRef<
24
- React.ElementRef<typeof AvatarPrimitive.Image>,
25
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
24
+ React.ElementRef<typeof AvatarPrimitive.Image>,
25
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
26
26
  >(({ className, ...props }, ref) => (
27
- <AvatarPrimitive.Image
28
- className={cn("aspect-square h-full w-full", className)}
29
- ref={ref}
30
- {...props}
31
- />
27
+ <AvatarPrimitive.Image
28
+ className={cn("aspect-square h-full w-full", className)}
29
+ ref={ref}
30
+ {...props}
31
+ />
32
32
  ));
33
33
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
34
34
 
35
35
  const AvatarFallback = React.forwardRef<
36
- React.ElementRef<typeof AvatarPrimitive.Fallback>,
37
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
36
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
37
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
38
38
  >(({ className, ...props }, ref) => (
39
- <AvatarPrimitive.Fallback
40
- className={cn(
41
- "flex h-full w-full items-center justify-center rounded-full bg-muted",
42
- className
43
- )}
44
- ref={ref}
45
- {...props}
46
- />
39
+ <AvatarPrimitive.Fallback
40
+ className={cn(
41
+ "flex h-full w-full items-center justify-center rounded-full bg-muted",
42
+ className,
43
+ )}
44
+ ref={ref}
45
+ {...props}
46
+ />
47
47
  ));
48
48
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
49
49
 
50
- export { Avatar, AvatarImage, AvatarFallback };
50
+ export { Avatar, AvatarFallback, AvatarImage };
@@ -4,33 +4,33 @@ import type * as React from "react";
4
4
  import { cn } from "@/lib/utils";
5
5
 
6
6
  const badgeVariants = cva(
7
- "inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8
- {
9
- variants: {
10
- variant: {
11
- default:
12
- "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13
- secondary:
14
- "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15
- destructive:
16
- "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17
- outline: "text-foreground",
18
- },
19
- },
20
- defaultVariants: {
21
- variant: "default",
22
- },
23
- }
7
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13
+ secondary:
14
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15
+ destructive:
16
+ "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17
+ outline: "text-foreground",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "default",
22
+ },
23
+ },
24
24
  );
25
25
 
26
26
  export interface BadgeProps
27
- extends React.HTMLAttributes<HTMLDivElement>,
28
- VariantProps<typeof badgeVariants> {}
27
+ extends React.HTMLAttributes<HTMLDivElement>,
28
+ VariantProps<typeof badgeVariants> {}
29
29
 
30
30
  function Badge({ className, variant, ...props }: BadgeProps) {
31
- return (
32
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
33
- );
31
+ return (
32
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
33
+ );
34
34
  }
35
35
 
36
36
  export { Badge, badgeVariants };