Compare commits

..

11 Commits

Author SHA1 Message Date
github-actions[bot]
59b2cc8142 chore(release): version packages (#2420)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-14 16:06:43 +04:00
Vulcan-Coder
0e721be8dd Update models.ts (#2374)
Fixed the space at the start of the UUID
2024-01-14 11:27:26 +00:00
shadcn
7640ef7bbc feat: add support for adding devDependencies in the cli (#2419)
* feat(cli): add support for install devDependencies

* chore: add changeset
2024-01-14 15:21:57 +04:00
김태강
8f3b28f50f feat(components): add "use client" directive to carousel, resizable component (#2319)
[Reopen a PR that was accidentally closed.](https://github.com/shadcn-ui/ui/pull/2233)
carousel, resizable components to be used by the app router, a "use client" directive is required.
2024-01-07 09:24:23 +00:00
vinay
73be841162 [Docs] Update CLI options while configuring components.json (#2283)
New Line added to the docs.
Just for the consistency.

![image](https://github.com/shadcn-ui/ui/assets/94120295/e0da71c1-72d1-4e5d-bba9-54634a9d0e31)
2024-01-07 09:23:35 +00:00
Nuriman Quddus
ad32fdeb7d fix: typo on carousel import (#2216)
# What's changed

- [x] Fixed the typo on carousel component

before fix: "@/registry/new-york/ui/carousel"
after fix: "@/components/ui/carousel"

this is ease the user to copy paste without error
2024-01-07 08:04:54 +00:00
Clarence
2dd7864007 fix: Github case correction (#2268) 2024-01-07 07:59:20 +00:00
Andrew Qiao
5d37bae1b8 fix(www): incorrect toggle aria labels and values (#2163)
- some `Toggle` and `ToggleGroup` demos had incorrect `aria-label` or `value` props
2024-01-07 07:49:26 +00:00
Chase
4b59cb812e fix(docs): Resizable panel direction should be horizontal (#2295)
In the [resizable documentation](https://ui.shadcn.com/docs/components/resizable) the handle example shows a horizontal handle but the code example has `direction="vertical"` when it should be `direction="horizontal"`

<img width="745" alt="Screenshot 2024-01-05 at 9 34 43 AM" src="https://github.com/shadcn-ui/ui/assets/7241069/68c21241-e0c7-41b1-81d7-579306149520">
2024-01-07 07:43:51 +00:00
Anshul Kanwar
4b200ebf59 docs: typo in drawer, dialog and sheet (#2306) 2024-01-07 07:26:21 +00:00
Tilak Thapa
33795426dd Fix: Add e.preventDefault() to prevent page reload (#2278)
Fixes #2277

Add `e.preventDefault()` to prevent page reload in mail component

![image](https://github.com/shadcn-ui/ui/assets/106688422/d1373e8f-0c46-4f2e-8caf-2fcd2076b2fb)
2024-01-07 07:17:47 +00:00
35 changed files with 66 additions and 32 deletions

View File

@@ -64,7 +64,7 @@ export function UserAuthForm({ className, ...props }: UserAuthFormProps) {
) : ( ) : (
<Icons.gitHub className="mr-2 h-4 w-4" /> <Icons.gitHub className="mr-2 h-4 w-4" />
)}{" "} )}{" "}
Github GitHub
</Button> </Button>
</div> </div>
) )

View File

@@ -236,7 +236,11 @@ export function MailDisplay({ mail }: MailDisplayProps) {
<Switch id="mute" aria-label="Mute thread" /> Mute this <Switch id="mute" aria-label="Mute thread" /> Mute this
thread thread
</Label> </Label>
<Button size="sm" className="ml-auto"> <Button
onClick={(e) => e.preventDefault()}
size="sm"
className="ml-auto"
>
Send Send
</Button> </Button>
</div> </div>

View File

@@ -95,7 +95,7 @@ export function PresetActions() {
<AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}> <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>Are you sure absolutely sure?</AlertDialogTitle> <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription> <AlertDialogDescription>
This action cannot be undone. This preset will no longer be This action cannot be undone. This preset will no longer be
accessible by you or others you&apos;ve shared it with. accessible by you or others you&apos;ve shared it with.

View File

@@ -36,7 +36,7 @@ export const models: Model<ModelType>[] = [
strengths: "Moderate classification, semantic search", strengths: "Moderate classification, semantic search",
}, },
{ {
id: " be638fb1-973b-4471-a49c-290325085802", id: "be638fb1-973b-4471-a49c-290325085802",
name: "text-ada-001", name: "text-ada-001",
description: description:
"Capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.", "Capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.",

View File

@@ -61,7 +61,7 @@ import {
CarouselItem, CarouselItem,
CarouselNext, CarouselNext,
CarouselPrevious, CarouselPrevious,
} from "@/registry/new-york/ui/carousel" } from "@/components/ui/carousel"
``` ```
```tsx ```tsx

View File

@@ -66,7 +66,7 @@ import {
<DialogTrigger>Open</DialogTrigger> <DialogTrigger>Open</DialogTrigger>
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>Are you sure absolutely sure?</DialogTitle> <DialogTitle>Are you absolutely sure?</DialogTitle>
<DialogDescription> <DialogDescription>
This action cannot be undone. This will permanently delete your account This action cannot be undone. This will permanently delete your account
and remove your data from our servers. and remove your data from our servers.
@@ -103,7 +103,7 @@ To activate the `Dialog` component from within a `Context Menu` or `Dropdown Men
</ContextMenu> </ContextMenu>
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>Are you sure absolutely sure?</DialogTitle> <DialogTitle>Are you absolutely sure?</DialogTitle>
<DialogDescription> <DialogDescription>
This action cannot be undone. Are you sure you want to permanently This action cannot be undone. Are you sure you want to permanently
delete this file from our servers? delete this file from our servers?

View File

@@ -70,7 +70,7 @@ import {
<DrawerTrigger>Open</DrawerTrigger> <DrawerTrigger>Open</DrawerTrigger>
<DrawerContent> <DrawerContent>
<DrawerHeader> <DrawerHeader>
<DrawerTitle>Are you sure absolutely sure?</DrawerTitle> <DrawerTitle>Are you absolutely sure?</DrawerTitle>
<DrawerDescription>This action cannot be undone.</DrawerDescription> <DrawerDescription>This action cannot be undone.</DrawerDescription>
</DrawerHeader> </DrawerHeader>
<DrawerFooter> <DrawerFooter>

View File

@@ -110,7 +110,7 @@ import {
export default function Example() { export default function Example() {
return ( return (
<ResizablePanelGroup direction="vertical"> <ResizablePanelGroup direction="horizontal">
<ResizablePanel>One</ResizablePanel> <ResizablePanel>One</ResizablePanel>
<ResizableHandle withHandle /> <ResizableHandle withHandle />
<ResizablePanel>Two</ResizablePanel> <ResizablePanel>Two</ResizablePanel>

View File

@@ -65,7 +65,7 @@ import {
<SheetTrigger>Open</SheetTrigger> <SheetTrigger>Open</SheetTrigger>
<SheetContent> <SheetContent>
<SheetHeader> <SheetHeader>
<SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetTitle>Are you absolutely sure?</SheetTitle>
<SheetDescription> <SheetDescription>
This action cannot be undone. This will permanently delete your account This action cannot be undone. This will permanently delete your account
and remove your data from our servers. and remove your data from our servers.
@@ -92,7 +92,7 @@ You can adjust the size of the sheet using CSS classes:
<SheetTrigger>Open</SheetTrigger> <SheetTrigger>Open</SheetTrigger>
<SheetContent className="w-[400px] sm:w-[540px]"> <SheetContent className="w-[400px] sm:w-[540px]">
<SheetHeader> <SheetHeader>
<SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetTitle>Are you absolutely sure?</SheetTitle>
<SheetDescription> <SheetDescription>
This action cannot be undone. This will permanently delete your account This action cannot be undone. This will permanently delete your account
and remove your data from our servers. and remove your data from our servers.

View File

@@ -31,6 +31,7 @@ Which style would you like to use? Default
Which color would you like to use as base color? Slate Which color would you like to use as base color? Slate
Where is your global CSS file? app/globals.css Where is your global CSS file? app/globals.css
Do you want to use CSS variables for colors? no / yes Do you want to use CSS variables for colors? no / yes
Are you using a custom tailwind prefix eg. tw-? (Leave blank if not) ...
Where is your tailwind.config.js located? tailwind.config.js Where is your tailwind.config.js located? tailwind.config.js
Configure the import alias for components: @/components Configure the import alias for components: @/components
Configure the import alias for utils: @/lib/utils Configure the import alias for utils: @/lib/utils

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
"files": [ "files": [
{ {
"name": "resizable.tsx", "name": "resizable.tsx",
"content": "import { GripVertical } from \"lucide-react\"\nimport * as ResizablePrimitive from \"react-resizable-panels\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (\n <ResizablePrimitive.PanelGroup\n className={cn(\n \"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\",\n className\n )}\n {...props}\n />\n)\n\nconst ResizablePanel = ResizablePrimitive.Panel\n\nconst ResizableHandle = ({\n withHandle,\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n withHandle?: boolean\n}) => (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n className\n )}\n {...props}\n >\n {withHandle && (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border\">\n <GripVertical className=\"h-2.5 w-2.5\" />\n </div>\n )}\n </ResizablePrimitive.PanelResizeHandle>\n)\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle }\n" "content": "\"use client\"\n\nimport { GripVertical } from \"lucide-react\"\nimport * as ResizablePrimitive from \"react-resizable-panels\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (\n <ResizablePrimitive.PanelGroup\n className={cn(\n \"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\",\n className\n )}\n {...props}\n />\n)\n\nconst ResizablePanel = ResizablePrimitive.Panel\n\nconst ResizableHandle = ({\n withHandle,\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n withHandle?: boolean\n}) => (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n className\n )}\n {...props}\n >\n {withHandle && (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border\">\n <GripVertical className=\"h-2.5 w-2.5\" />\n </div>\n )}\n </ResizablePrimitive.PanelResizeHandle>\n)\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle }\n"
} }
], ],
"type": "components:ui" "type": "components:ui"

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
"files": [ "files": [
{ {
"name": "resizable.tsx", "name": "resizable.tsx",
"content": "import { DragHandleDots2Icon } from \"@radix-ui/react-icons\"\nimport * as ResizablePrimitive from \"react-resizable-panels\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (\n <ResizablePrimitive.PanelGroup\n className={cn(\n \"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\",\n className\n )}\n {...props}\n />\n)\n\nconst ResizablePanel = ResizablePrimitive.Panel\n\nconst ResizableHandle = ({\n withHandle,\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n withHandle?: boolean\n}) => (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n className\n )}\n {...props}\n >\n {withHandle && (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border\">\n <DragHandleDots2Icon className=\"h-2.5 w-2.5\" />\n </div>\n )}\n </ResizablePrimitive.PanelResizeHandle>\n)\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle }\n" "content": "\"use client\"\n\nimport { DragHandleDots2Icon } from \"@radix-ui/react-icons\"\nimport * as ResizablePrimitive from \"react-resizable-panels\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (\n <ResizablePrimitive.PanelGroup\n className={cn(\n \"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\",\n className\n )}\n {...props}\n />\n)\n\nconst ResizablePanel = ResizablePrimitive.Panel\n\nconst ResizableHandle = ({\n withHandle,\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n withHandle?: boolean\n}) => (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n className\n )}\n {...props}\n >\n {withHandle && (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border\">\n <DragHandleDots2Icon className=\"h-2.5 w-2.5\" />\n </div>\n )}\n </ResizablePrimitive.PanelResizeHandle>\n)\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle }\n"
} }
], ],
"type": "components:ui" "type": "components:ui"

View File

@@ -4,7 +4,7 @@ import { Toggle } from "@/registry/default/ui/toggle"
export default function ToggleDemo() { export default function ToggleDemo() {
return ( return (
<Toggle aria-label="Toggle italic"> <Toggle aria-label="Toggle bold">
<Bold className="h-4 w-4" /> <Bold className="h-4 w-4" />
</Toggle> </Toggle>
) )

View File

@@ -4,7 +4,7 @@ import { Toggle } from "@/registry/default/ui/toggle"
export default function ToggleDisabled() { export default function ToggleDisabled() {
return ( return (
<Toggle aria-label="Toggle italic" disabled> <Toggle aria-label="Toggle underline" disabled>
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</Toggle> </Toggle>
) )

View File

@@ -14,7 +14,7 @@ export default function ToggleGroupDemo() {
<ToggleGroupItem value="italic" aria-label="Toggle italic"> <ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic className="h-4 w-4" /> <Italic className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem value="strikethrough" aria-label="Toggle strikethrough"> <ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
</ToggleGroup> </ToggleGroup>

View File

@@ -14,7 +14,7 @@ export default function ToggleGroupDemo() {
<ToggleGroupItem value="italic" aria-label="Toggle italic"> <ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic className="h-4 w-4" /> <Italic className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem value="strikethrough" aria-label="Toggle strikethrough"> <ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
</ToggleGroup> </ToggleGroup>

View File

@@ -14,7 +14,7 @@ export default function ToggleGroupDemo() {
<ToggleGroupItem value="italic" aria-label="Toggle italic"> <ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic className="h-4 w-4" /> <Italic className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem value="strikethrough" aria-label="Toggle strikethrough"> <ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
</ToggleGroup> </ToggleGroup>

View File

@@ -14,7 +14,7 @@ export default function ToggleGroupDemo() {
<ToggleGroupItem value="italic" aria-label="Toggle italic"> <ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic className="h-4 w-4" /> <Italic className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem value="strikethrough" aria-label="Toggle strikethrough"> <ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
</ToggleGroup> </ToggleGroup>

View File

@@ -14,7 +14,7 @@ export default function ToggleGroupDemo() {
<ToggleGroupItem value="italic" aria-label="Toggle italic"> <ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic className="h-4 w-4" /> <Italic className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem value="strikethrough" aria-label="Toggle strikethrough"> <ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
</ToggleGroup> </ToggleGroup>

View File

@@ -14,7 +14,7 @@ export default function ToggleGroupDemo() {
<ToggleGroupItem value="italic" aria-label="Toggle italic"> <ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic className="h-4 w-4" /> <Italic className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem value="strikethrough" aria-label="Toggle strikethrough"> <ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline className="h-4 w-4" /> <Underline className="h-4 w-4" />
</ToggleGroupItem> </ToggleGroupItem>
</ToggleGroup> </ToggleGroup>

View File

@@ -1,5 +1,3 @@
export default function TypographyLarge() { export default function TypographyLarge() {
return ( return <div className="text-lg font-semibold">Are you absolutely sure?</div>
<div className="text-lg font-semibold">Are you sure absolutely sure?</div>
)
} }

View File

@@ -1,3 +1,5 @@
"use client"
import * as React from "react" import * as React from "react"
import useEmblaCarousel, { import useEmblaCarousel, {
type EmblaCarouselType as CarouselApi, type EmblaCarouselType as CarouselApi,

View File

@@ -1,3 +1,5 @@
"use client"
import { GripVertical } from "lucide-react" import { GripVertical } from "lucide-react"
import * as ResizablePrimitive from "react-resizable-panels" import * as ResizablePrimitive from "react-resizable-panels"

View File

@@ -26,7 +26,7 @@ export function CardsCreateAccount() {
<div className="grid grid-cols-2 gap-6"> <div className="grid grid-cols-2 gap-6">
<Button variant="outline"> <Button variant="outline">
<Icons.gitHub className="mr-2 h-4 w-4" /> <Icons.gitHub className="mr-2 h-4 w-4" />
Github GitHub
</Button> </Button>
<Button variant="outline"> <Button variant="outline">
<Icons.google className="mr-2 h-4 w-4" /> <Icons.google className="mr-2 h-4 w-4" />

View File

@@ -1,5 +1,3 @@
export default function TypographyLarge() { export default function TypographyLarge() {
return ( return <div className="text-lg font-semibold">Are you absolutely sure?</div>
<div className="text-lg font-semibold">Are you sure absolutely sure?</div>
)
} }

View File

@@ -1,3 +1,5 @@
"use client"
import * as React from "react" import * as React from "react"
import { ArrowLeftIcon, ArrowRightIcon } from "@radix-ui/react-icons" import { ArrowLeftIcon, ArrowRightIcon } from "@radix-ui/react-icons"
import useEmblaCarousel, { import useEmblaCarousel, {

View File

@@ -1,3 +1,5 @@
"use client"
import { DragHandleDots2Icon } from "@radix-ui/react-icons" import { DragHandleDots2Icon } from "@radix-ui/react-icons"
import * as ResizablePrimitive from "react-resizable-panels" import * as ResizablePrimitive from "react-resizable-panels"

View File

@@ -60,6 +60,7 @@ const ui: Registry = [
files: ["ui/carousel.tsx"], files: ["ui/carousel.tsx"],
registryDependencies: ["button"], registryDependencies: ["button"],
dependencies: ["embla-carousel-react"], dependencies: ["embla-carousel-react"],
devDependencies: ["embla-carousel"],
}, },
{ {
name: "checkbox", name: "checkbox",

View File

@@ -4,6 +4,7 @@ export const registrySchema = z.array(
z.object({ z.object({
name: z.string(), name: z.string(),
dependencies: z.array(z.string()).optional(), dependencies: z.array(z.string()).optional(),
devDependencies: z.array(z.string()).optional(),
registryDependencies: z.array(z.string()).optional(), registryDependencies: z.array(z.string()).optional(),
files: z.array(z.string()), files: z.array(z.string()),
type: z.enum([ type: z.enum([

View File

@@ -1,5 +1,11 @@
# @shadcn/ui # @shadcn/ui
## 0.7.0
### Minor Changes
- [#2419](https://github.com/shadcn-ui/ui/pull/2419) [`7640ef7`](https://github.com/shadcn-ui/ui/commit/7640ef7bbc5fea280a8b5227a2455bb840478573) Thanks [@shadcn](https://github.com/shadcn)! - add support for devDependencies
## 0.6.0 ## 0.6.0
### Minor Changes ### Minor Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "shadcn-ui", "name": "shadcn-ui",
"version": "0.6.0", "version": "0.7.0",
"description": "Add components to your apps.", "description": "Add components to your apps.",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@@ -180,9 +180,10 @@ export const add = new Command()
await fs.writeFile(filePath, content) await fs.writeFile(filePath, content)
} }
const packageManager = await getPackageManager(cwd)
// Install dependencies. // Install dependencies.
if (item.dependencies?.length) { if (item.dependencies?.length) {
const packageManager = await getPackageManager(cwd)
await execa( await execa(
packageManager, packageManager,
[ [
@@ -194,6 +195,21 @@ export const add = new Command()
} }
) )
} }
// Install devDependencies.
if (item.devDependencies?.length) {
await execa(
packageManager,
[
packageManager === "npm" ? "install" : "add",
"-D",
...item.devDependencies,
],
{
cwd,
}
)
}
} }
spinner.succeed(`Done.`) spinner.succeed(`Done.`)
} catch (error) { } catch (error) {

View File

@@ -4,6 +4,7 @@ import * as z from "zod"
export const registryItemSchema = z.object({ export const registryItemSchema = z.object({
name: z.string(), name: z.string(),
dependencies: z.array(z.string()).optional(), dependencies: z.array(z.string()).optional(),
devDependencies: z.array(z.string()).optional(),
registryDependencies: z.array(z.string()).optional(), registryDependencies: z.array(z.string()).optional(),
files: z.array(z.string()), files: z.array(z.string()),
type: z.enum(["components:ui", "components:component", "components:example"]), type: z.enum(["components:ui", "components:component", "components:example"]),