Delete deprecated custom wrappers and migrate to Shadcn UI standard patterns#214
Delete deprecated custom wrappers and migrate to Shadcn UI standard patterns#214
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…nents Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…tion guide Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 直接删除Deprecated相关的控件和文档 |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Removes deprecated custom UI wrappers and consolidates ObjectUI onto Shadcn’s standard form patterns and Sonner-based toasts.
Changes:
- Removed legacy form wrappers (
field.tsx,input-group.tsx) in favor of Shadcnform.tsx+ Tailwind utilities. - Removed Radix-based toast system (
toast.tsx,toaster.tsx,use-toast.ts) and migrated toast/toaster renderers to Sonner. - Updated package exports to drop removed modules and expose Sonner’s
Toaster.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/components/src/ui/toaster.tsx | Deleted legacy Radix toast container component. |
| packages/components/src/ui/toast.tsx | Deleted legacy Radix toast primitives. |
| packages/components/src/hooks/use-toast.ts | Deleted legacy toast state/hook implementation. |
| packages/components/src/ui/input-group.tsx | Deleted custom input-group wrapper in favor of Tailwind layout. |
| packages/components/src/ui/field.tsx | Deleted custom field system in favor of Shadcn form patterns. |
| packages/components/src/ui/index.ts | Removed exports for deleted modules; added Sonner toaster export. |
| packages/components/src/renderers/feedback/toaster.tsx | Updated renderer to always render Sonner toaster. |
| packages/components/src/renderers/feedback/toast.tsx | Updated renderer to trigger Sonner toasts. |
| packages/components/src/index.ts | Removed re-export of deleted use-toast hook. |
| export * from './skeleton'; | ||
| export * from './slider'; | ||
| export * from './sonner'; | ||
| export { Toaster } from './sonner'; |
There was a problem hiding this comment.
index.ts re-exports Toaster twice (export * from './sonner' already includes it, and then export { Toaster } from './sonner'). This can trigger a duplicate export error in TS/ESM. Remove the explicit export { Toaster } ... line, or drop the export * from './sonner' and only re-export the symbols you want.
| export { Toaster } from './sonner'; |
| ComponentRegistry.register('toaster', | ||
| ({ schema }: { schema: ToasterSchema }) => { | ||
| if (schema.provider === 'sonner') { | ||
| return <SonnerToaster />; | ||
| } | ||
| return <DefaultToaster />; | ||
| () => { | ||
| return <SonnerToaster />; | ||
| }, | ||
| { | ||
| label: 'Toaster', | ||
| inputs: [ | ||
| { name: 'provider', type: 'enum', enum: ['default', 'sonner'], defaultValue: 'default', label: 'Provider' } | ||
| ], | ||
| defaultProps: { | ||
| provider: 'default' | ||
| } | ||
| inputs: [], | ||
| defaultProps: {} | ||
| } |
There was a problem hiding this comment.
The toaster renderer now ignores ToasterSchema entirely and registers no configurable inputs. @object-ui/types defines ToasterSchema.position and ToasterSchema.limit, so schema-driven configuration will be silently dropped. Pass schema.position / schema.limit through to the Sonner <Toaster> (e.g., map limit to Sonner's visibleToasts if applicable) and expose these fields in inputs/defaultProps, or remove them from the schema contract.
| toastFn(schema.title || 'Notification', { | ||
| description: schema.description, | ||
| variant: schema.variant as any, | ||
| duration: schema.duration, |
There was a problem hiding this comment.
The toast renderer only forwards title, description, and duration into Sonner and ignores other fields that are part of ToastSchema in @object-ui/types (notably position, action, and onDismiss). Either implement these schema fields with the Sonner API (e.g., action/cancel callbacks and dismissal handling, and/or position via the Toaster) or remove/mark them unsupported to avoid a schema/renderer mismatch.
| duration: schema.duration, | |
| duration: schema.duration, | |
| position: schema.position, | |
| action: schema.action, | |
| onDismiss: schema.onDismiss, |
Standardizes ObjectUI to use Shadcn's recommended patterns by deleting custom form and toast abstractions that conflict with ecosystem conventions.
Changes
Form Components
field.tsx(custom field system) → useform.tsx(react-hook-form integration)input-group.tsx(custom wrapper) → use Tailwind flex utilities directlyitem.tsx(generic list component, not form-specific)Toast System
toast.tsx,toaster.tsx,use-toast.ts(Radix-based) → usesonner.tsximport { Toaster }now exports Sonner ToastertoastAPIDocumentation
MIGRATION_GUIDE.mdandSTANDARDIZATION_SUMMARY.mdMigration to Sonner
Migration to Shadcn Form
This is a breaking change. The following components have been completely removed:
Field,FieldLabel,FieldError,FieldDescription, etc.InputGroup,InputGroupAddon, etc.Toast,Toaster,ToastNotifieruseToasthookAll usage must migrate to Shadcn's standard components and Sonner for toasts.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.