Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asChild API in Components by Adding Radix Slottable #6105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ npx shadcn@latest add accordion
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-accordion
npm install @radix-ui/react-accordion @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/context-menu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npx shadcn@latest add context-menu
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-context-menu
npm install @radix-ui/react-context-menu @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/dialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npx shadcn@latest add dialog
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-dialog
npm install @radix-ui/react-dialog @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/drawer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npx shadcn@latest add drawer
<Step>Install the following dependencies:</Step>

```bash
npm install vaul
npm install vaul @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/dropdown-menu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npx shadcn@latest add dropdown-menu
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-dropdown-menu
npm install @radix-ui/react-dropdown-menu @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/menubar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npx shadcn@latest add menubar
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-menubar
npm install @radix-ui/react-menubar @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/navigation-menu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npx shadcn@latest add navigation-menu
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-navigation-menu
npm install @radix-ui/react-navigation-menu @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/select.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npx shadcn@latest add select
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-select
npm install @radix-ui/react-select @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/sheet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npx shadcn@latest add sheet
<Step>Install the following dependencies:</Step>

```bash
npm install @radix-ui/react-dialog
npm install @radix-ui/react-dialog @radix-ui/react-slot
```

<Step>Copy and paste the following code into your project.</Step>
Expand Down
27 changes: 18 additions & 9 deletions apps/www/public/r/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "accordion",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-accordion"
"@radix-ui/react-accordion",
"@radix-ui/react-slot"
],
"files": [
{
Expand Down Expand Up @@ -236,7 +237,8 @@
"name": "context-menu",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-context-menu"
"@radix-ui/react-context-menu",
"@radix-ui/react-slot"
],
"files": [
{
Expand All @@ -249,7 +251,8 @@
"name": "dialog",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-dialog"
"@radix-ui/react-dialog",
"@radix-ui/react-slot"
],
"files": [
{
Expand All @@ -263,7 +266,8 @@
"type": "registry:ui",
"dependencies": [
"vaul",
"@radix-ui/react-dialog"
"@radix-ui/react-dialog",
"@radix-ui/react-slot"
],
"files": [
{
Expand All @@ -276,7 +280,8 @@
"name": "dropdown-menu",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-dropdown-menu"
"@radix-ui/react-dropdown-menu",
"@radix-ui/react-slot"
],
"files": [
{
Expand Down Expand Up @@ -359,7 +364,8 @@
"name": "menubar",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-menubar"
"@radix-ui/react-menubar",
"@radix-ui/react-slot"
],
"files": [
{
Expand All @@ -372,7 +378,8 @@
"name": "navigation-menu",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-navigation-menu"
"@radix-ui/react-navigation-menu",
"@radix-ui/react-slot"
],
"files": [
{
Expand Down Expand Up @@ -463,7 +470,8 @@
"name": "select",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-select"
"@radix-ui/react-select",
"@radix-ui/react-slot"
],
"files": [
{
Expand All @@ -489,7 +497,8 @@
"name": "sheet",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-dialog"
"@radix-ui/react-dialog",
"@radix-ui/react-slot"
],
"files": [
{
Expand Down
5 changes: 3 additions & 2 deletions apps/www/public/r/styles/default/accordion.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"name": "accordion",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-accordion"
"@radix-ui/react-accordion",
"@radix-ui/react-slot"
],
"files": [
{
"path": "ui/accordion.tsx",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\"\nimport { ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Accordion = AccordionPrimitive.Root\n\nconst AccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn(\"border-b\", className)}\n {...props}\n />\n))\nAccordionItem.displayName = \"AccordionItem\"\n\nconst AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDown className=\"h-4 w-4 shrink-0 transition-transform duration-200\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n))\nAccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName\n\nconst AccordionContent = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Content\n ref={ref}\n className=\"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down\"\n {...props}\n >\n <div className={cn(\"pb-4 pt-0\", className)}>{children}</div>\n </AccordionPrimitive.Content>\n))\n\nAccordionContent.displayName = AccordionPrimitive.Content.displayName\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent }\n",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\"\nimport { Slottable } from \"@radix-ui/react-slot\"\nimport { ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Accordion = AccordionPrimitive.Root\n\nconst AccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn(\"border-b\", className)}\n {...props}\n />\n))\nAccordionItem.displayName = \"AccordionItem\"\n\nconst AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180\",\n className\n )}\n {...props}\n >\n <Slottable>{children}</Slottable>\n <ChevronDown className=\"h-4 w-4 shrink-0 transition-transform duration-200\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n))\nAccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName\n\nconst AccordionContent = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Content\n ref={ref}\n className=\"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down\"\n {...props}\n >\n <div className={cn(\"pb-4 pt-0\", className)}>{children}</div>\n </AccordionPrimitive.Content>\n))\n\nAccordionContent.displayName = AccordionPrimitive.Content.displayName\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent }\n",
"type": "registry:ui",
"target": ""
}
Expand Down
Loading