Skip to content

Commit

Permalink
fix(combobox): fixes issue 4101 with combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
danewhitfield committed Jul 6, 2024
1 parent c1b9554 commit 5e3358f
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 66 deletions.
2 changes: 1 addition & 1 deletion apps/www/__registry__/default/block/chart-pie-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Component() {
<CardContent className="flex-1 pb-0">
<ChartContainer
config={chartConfig}
className="mx-auto aspect-square max-h-[250px] pb-0"
className="mx-auto aspect-square max-h-[250px] pb-0 [&_.recharts-pie-label-text]:fill-foreground"
>
<PieChart>
<ChartTooltip content={<ChartTooltipContent hideLabel />} />
Expand Down
11 changes: 2 additions & 9 deletions apps/www/__registry__/default/block/chart-pie-legend.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { LabelList, Pie, PieChart } from "recharts"
import { Pie, PieChart } from "recharts"

import {
Card,
Expand Down Expand Up @@ -65,14 +65,7 @@ export default function Component() {
className="mx-auto aspect-square max-h-[300px]"
>
<PieChart>
<Pie data={chartData} dataKey="visitors">
<LabelList
dataKey="visitors"
className="fill-background"
stroke="none"
fontSize={12}
/>
</Pie>
<Pie data={chartData} dataKey="visitors" />
<ChartLegend
content={<ChartLegendContent nameKey="browser" />}
className="-translate-y-2 flex-wrap gap-2 [&>*]:basis-1/4 [&>*]:justify-center"
Expand Down
4 changes: 3 additions & 1 deletion apps/www/__registry__/default/block/dashboard-01.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ export default function Dashboard() {
</Card>
</div>
<div className="grid gap-4 md:gap-8 lg:grid-cols-2 xl:grid-cols-3">
<Card className="xl:col-span-2" x-chunk="dashboard-01-chunk-4">
<Card
className="xl:col-span-2" x-chunk="dashboard-01-chunk-4"
>
<CardHeader className="flex flex-row items-center">
<div className="grid gap-2">
<CardTitle>Transactions</CardTitle>
Expand Down
3 changes: 1 addition & 2 deletions apps/www/__registry__/default/block/dashboard-02.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ export default function Dashboard() {
<h1 className="text-lg font-semibold md:text-2xl">Inventory</h1>
</div>
<div
className="flex flex-1 items-center justify-center rounded-lg border border-dashed shadow-sm"
x-chunk="dashboard-02-chunk-1"
className="flex flex-1 items-center justify-center rounded-lg border border-dashed shadow-sm" x-chunk="dashboard-02-chunk-1"
>
<div className="flex flex-col items-center gap-1 text-center">
<h3 className="text-2xl font-bold tracking-tight">
Expand Down
6 changes: 2 additions & 4 deletions apps/www/__registry__/default/block/dashboard-03.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ export default function Dashboard() {
</header>
<main className="grid flex-1 gap-4 overflow-auto p-4 md:grid-cols-2 lg:grid-cols-3">
<div
className="relative hidden flex-col items-start gap-8 md:flex"
x-chunk="dashboard-03-chunk-0"
className="relative hidden flex-col items-start gap-8 md:flex" x-chunk="dashboard-03-chunk-0"
>
<form className="grid w-full items-start gap-6">
<fieldset className="grid gap-6 rounded-lg border p-4">
Expand Down Expand Up @@ -420,8 +419,7 @@ export default function Dashboard() {
</Badge>
<div className="flex-1" />
<form
className="relative overflow-hidden rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring"
x-chunk="dashboard-03-chunk-1"
className="relative overflow-hidden rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring" x-chunk="dashboard-03-chunk-1"
>
<Label htmlFor="message" className="sr-only">
Message
Expand Down
3 changes: 1 addition & 2 deletions apps/www/__registry__/default/block/dashboard-04.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ export default function Dashboard() {
</div>
<div className="mx-auto grid w-full max-w-6xl items-start gap-6 md:grid-cols-[180px_1fr] lg:grid-cols-[250px_1fr]">
<nav
className="grid gap-4 text-sm text-muted-foreground"
x-chunk="dashboard-04-chunk-0"
className="grid gap-4 text-sm text-muted-foreground" x-chunk="dashboard-04-chunk-0"
>
<Link href="#" className="font-semibold text-primary">
General
Expand Down
8 changes: 6 additions & 2 deletions apps/www/__registry__/default/block/dashboard-05.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ export default function Dashboard() {
<main className="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8 lg:grid-cols-3 xl:grid-cols-3">
<div className="grid auto-rows-max items-start gap-4 md:gap-8 lg:col-span-2">
<div className="grid gap-4 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-2 xl:grid-cols-4">
<Card className="sm:col-span-2" x-chunk="dashboard-05-chunk-0">
<Card
className="sm:col-span-2" x-chunk="dashboard-05-chunk-0"
>
<CardHeader className="pb-3">
<CardTitle>Your Orders</CardTitle>
<CardDescription className="max-w-lg text-balance leading-relaxed">
Expand Down Expand Up @@ -561,7 +563,9 @@ export default function Dashboard() {
</Tabs>
</div>
<div>
<Card className="overflow-hidden" x-chunk="dashboard-05-chunk-4">
<Card
className="overflow-hidden" x-chunk="dashboard-05-chunk-4"
>
<CardHeader className="flex flex-row items-start bg-muted/50">
<div className="grid gap-0.5">
<CardTitle className="group flex items-center gap-2 text-lg">
Expand Down
3 changes: 1 addition & 2 deletions apps/www/__registry__/default/block/dashboard-07.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ export default function Dashboard() {
</CardContent>
</Card>
<Card
className="overflow-hidden"
x-chunk="dashboard-07-chunk-4"
className="overflow-hidden" x-chunk="dashboard-07-chunk-4"
>
<CardHeader>
<CardTitle>Product Images</CardTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import {
CardDescription,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
} from "@/registry/new-york/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/default/ui/chart"
} from "@/registry/new-york/ui/chart"

export const description = "An interactive bar chart"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Component() {
<CardContent className="flex-1 pb-0">
<ChartContainer
config={chartConfig}
className="mx-auto aspect-square max-h-[250px]"
className="mx-auto aspect-square max-h-[250px] px-0"
>
<PieChart>
<ChartTooltip
Expand All @@ -85,10 +85,7 @@ export default function Component() {
dominantBaseline={props.dominantBaseline}
fill="hsla(var(--foreground))"
>
{`${
chartConfig[payload.browser as keyof typeof chartConfig]
?.label
} (${payload.visitors})`}
{payload.visitors}
</text>
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Component() {
<CardContent className="flex-1 pb-0">
<ChartContainer
config={chartConfig}
className="mx-auto aspect-square max-h-[250px]"
className="mx-auto aspect-square max-h-[250px] [&_.recharts-text]:fill-background"
>
<PieChart>
<ChartTooltip
Expand Down
2 changes: 1 addition & 1 deletion apps/www/__registry__/new-york/block/chart-pie-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Component() {
<CardContent className="flex-1 pb-0">
<ChartContainer
config={chartConfig}
className="mx-auto aspect-square max-h-[250px] pb-0"
className="mx-auto aspect-square max-h-[250px] pb-0 [&_.recharts-pie-label-text]:fill-foreground"
>
<PieChart>
<ChartTooltip content={<ChartTooltipContent hideLabel />} />
Expand Down
11 changes: 2 additions & 9 deletions apps/www/__registry__/new-york/block/chart-pie-legend.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { LabelList, Pie, PieChart } from "recharts"
import { Pie, PieChart } from "recharts"

import {
Card,
Expand Down Expand Up @@ -65,14 +65,7 @@ export default function Component() {
className="mx-auto aspect-square max-h-[300px]"
>
<PieChart>
<Pie data={chartData} dataKey="visitors">
<LabelList
dataKey="visitors"
className="fill-background"
stroke="none"
fontSize={12}
/>
</Pie>
<Pie data={chartData} dataKey="visitors" />
<ChartLegend
content={<ChartLegendContent nameKey="browser" />}
className="-translate-y-2 flex-wrap gap-2 [&>*]:basis-1/4 [&>*]:justify-center"
Expand Down
4 changes: 3 additions & 1 deletion apps/www/__registry__/new-york/block/dashboard-01.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ export default function Dashboard() {
</Card>
</div>
<div className="grid gap-4 md:gap-8 lg:grid-cols-2 xl:grid-cols-3">
<Card className="xl:col-span-2" x-chunk="dashboard-01-chunk-4">
<Card
className="xl:col-span-2" x-chunk="dashboard-01-chunk-4"
>
<CardHeader className="flex flex-row items-center">
<div className="grid gap-2">
<CardTitle>Transactions</CardTitle>
Expand Down
3 changes: 1 addition & 2 deletions apps/www/__registry__/new-york/block/dashboard-02.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ export default function Dashboard() {
<h1 className="text-lg font-semibold md:text-2xl">Inventory</h1>
</div>
<div
className="flex flex-1 items-center justify-center rounded-lg border border-dashed shadow-sm"
x-chunk="dashboard-02-chunk-1"
className="flex flex-1 items-center justify-center rounded-lg border border-dashed shadow-sm" x-chunk="dashboard-02-chunk-1"
>
<div className="flex flex-col items-center gap-1 text-center">
<h3 className="text-2xl font-bold tracking-tight">
Expand Down
6 changes: 2 additions & 4 deletions apps/www/__registry__/new-york/block/dashboard-03.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ export default function Dashboard() {
</header>
<main className="grid flex-1 gap-4 overflow-auto p-4 md:grid-cols-2 lg:grid-cols-3">
<div
className="relative hidden flex-col items-start gap-8 md:flex"
x-chunk="dashboard-03-chunk-0"
className="relative hidden flex-col items-start gap-8 md:flex" x-chunk="dashboard-03-chunk-0"
>
<form className="grid w-full items-start gap-6">
<fieldset className="grid gap-6 rounded-lg border p-4">
Expand Down Expand Up @@ -420,8 +419,7 @@ export default function Dashboard() {
</Badge>
<div className="flex-1" />
<form
className="relative overflow-hidden rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring"
x-chunk="dashboard-03-chunk-1"
className="relative overflow-hidden rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring" x-chunk="dashboard-03-chunk-1"
>
<Label htmlFor="message" className="sr-only">
Message
Expand Down
3 changes: 1 addition & 2 deletions apps/www/__registry__/new-york/block/dashboard-04.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ export default function Dashboard() {
</div>
<div className="mx-auto grid w-full max-w-6xl items-start gap-6 md:grid-cols-[180px_1fr] lg:grid-cols-[250px_1fr]">
<nav
className="grid gap-4 text-sm text-muted-foreground"
x-chunk="dashboard-04-chunk-0"
className="grid gap-4 text-sm text-muted-foreground" x-chunk="dashboard-04-chunk-0"
>
<Link href="#" className="font-semibold text-primary">
General
Expand Down
8 changes: 6 additions & 2 deletions apps/www/__registry__/new-york/block/dashboard-05.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ export default function Dashboard() {
<main className="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8 lg:grid-cols-3 xl:grid-cols-3">
<div className="grid auto-rows-max items-start gap-4 md:gap-8 lg:col-span-2">
<div className="grid gap-4 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-2 xl:grid-cols-4">
<Card className="sm:col-span-2" x-chunk="dashboard-05-chunk-0">
<Card
className="sm:col-span-2" x-chunk="dashboard-05-chunk-0"
>
<CardHeader className="pb-3">
<CardTitle>Your Orders</CardTitle>
<CardDescription className="max-w-lg text-balance leading-relaxed">
Expand Down Expand Up @@ -562,7 +564,9 @@ export default function Dashboard() {
</Tabs>
</div>
<div>
<Card className="overflow-hidden" x-chunk="dashboard-05-chunk-4">
<Card
className="overflow-hidden" x-chunk="dashboard-05-chunk-4"
>
<CardHeader className="flex flex-row items-start bg-muted/50">
<div className="grid gap-0.5">
<CardTitle className="group flex items-center gap-2 text-lg">
Expand Down
3 changes: 1 addition & 2 deletions apps/www/__registry__/new-york/block/dashboard-07.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ export default function Dashboard() {
</CardContent>
</Card>
<Card
className="overflow-hidden"
x-chunk="dashboard-07-chunk-4"
className="overflow-hidden" x-chunk="dashboard-07-chunk-4"
>
<CardHeader>
<CardTitle>Product Images</CardTitle>
Expand Down
11 changes: 7 additions & 4 deletions apps/www/content/docs/components/combobox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ export function ComboboxDemo() {
variant="outline"
role="combobox"
aria-expanded={open}
className="w-[200px] justify-between"
className="flex w-[200px] items-center justify-between"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<span className="truncate">
{value
? frameworks.find((framework) => framework.value === value)
?.label || ""
: "Select framework..."}
</span>
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
Expand Down
11 changes: 7 additions & 4 deletions apps/www/registry/default/example/combobox-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ export default function ComboboxDemo() {
variant="outline"
role="combobox"
aria-expanded={open}
className="w-[200px] justify-between"
className="flex w-[200px] items-center justify-between"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<span className="truncate">
{value
? frameworks.find((framework) => framework.value === value)
?.label || ""
: "Select framework..."}
</span>
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
Expand Down
11 changes: 7 additions & 4 deletions apps/www/registry/new-york/example/combobox-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ export default function ComboboxDemo() {
variant="outline"
role="combobox"
aria-expanded={open}
className="w-[200px] justify-between"
className="flex w-[200px] items-center justify-between"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<span className="truncate">
{value
? frameworks.find((framework) => framework.value === value)
?.label || ""
: "Select framework..."}
</span>
<CaretSortIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
Expand Down

0 comments on commit 5e3358f

Please sign in to comment.