Files
zeekay 16c4453cc1 feat: sync with upstream shadcn/ui (through [email protected])
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in:
- [email protected] through [email protected] releases
- New apps/v4 directory structure
- Registry system improvements and MCP server
- Framework support (Vue, Svelte, React Native)
- New templates (vite-app, monorepo-next, laravel)
- Zod 4 compatibility (scoped override for zod@>4)
- Test fixture corrections for alias resolution

All 867 merge conflicts resolved preserving Hanzo customizations.
1020/1020 shadcn tests pass.
2026-02-09 10:44:26 -08:00

103 lines
2.9 KiB
TypeScript

"use client"
import { Button } from "@/examples/radix/ui-rtl/button"
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/examples/radix/ui-rtl/dialog"
import { Field, FieldGroup } from "@/examples/radix/ui-rtl/field"
import { Input } from "@/examples/radix/ui-rtl/input"
import { Label } from "@/examples/radix/ui-rtl/label"
import {
useTranslation,
type Translations,
} from "@/components/language-selector"
const translations: Translations = {
en: {
dir: "ltr",
values: {
openDialog: "Open Dialog",
editProfile: "Edit profile",
description:
"Make changes to your profile here. Click save when you're done.",
name: "Name",
username: "Username",
cancel: "Cancel",
saveChanges: "Save changes",
},
},
ar: {
dir: "rtl",
values: {
openDialog: "فتح الحوار",
editProfile: "تعديل الملف الشخصي",
description:
"قم بإجراء تغييرات على ملفك الشخصي هنا. انقر فوق حفظ عند الانتهاء.",
name: "الاسم",
username: "اسم المستخدم",
cancel: "إلغاء",
saveChanges: "حفظ التغييرات",
},
},
he: {
dir: "rtl",
values: {
openDialog: "פתח דיאלוג",
editProfile: "ערוך פרופיל",
description: "בצע שינויים בפרופיל שלך כאן. לחץ על שמור כשתסיים.",
name: "שם",
username: "שם משתמש",
cancel: "בטל",
saveChanges: "שמור שינויים",
},
},
}
export function DialogRtl() {
const { dir, t, language } = useTranslation(translations, "ar")
return (
<Dialog>
<form>
<DialogTrigger asChild>
<Button variant="outline">{t.openDialog}</Button>
</DialogTrigger>
<DialogContent
className="sm:max-w-sm"
dir={dir}
data-lang={dir === "rtl" ? language : undefined}
>
<DialogHeader>
<DialogTitle>{t.editProfile}</DialogTitle>
<DialogDescription>{t.description}</DialogDescription>
</DialogHeader>
<FieldGroup>
<Field>
<Label htmlFor="name-1">{t.name}</Label>
<Input id="name-1" name="name" defaultValue="Pedro Duarte" />
</Field>
<Field>
<Label htmlFor="username-1">{t.username}</Label>
<Input id="username-1" name="username" defaultValue="@peduarte" />
</Field>
</FieldGroup>
<DialogFooter>
<DialogClose asChild>
<Button variant="outline">{t.cancel}</Button>
</DialogClose>
<Button type="submit">{t.saveChanges}</Button>
</DialogFooter>
</DialogContent>
</form>
</Dialog>
)
}