chore: refactor UI package paths and imports for consistency

- Updated tsconfig files to standardize module resolution paths for the UI package.
- Modified component import paths in components.json to align with the new structure.
- Refactored import statements in various UI components to use the updated paths from '@cherrystudio/ui'.
- Added new exports for UI components in the index file to enhance accessibility.
This commit is contained in:
MyPrototypeWhat 2025-10-16 15:18:35 +08:00
parent c258035f6a
commit b41e1d712f
10 changed files with 29 additions and 26 deletions

View File

@ -1,11 +1,11 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"aliases": {
"components": "@/components",
"hooks": "@/hooks",
"lib": "@/lib",
"ui": "@/components/ui",
"utils": "@/utils"
"components": "@cherrystudio/ui/components",
"hooks": "@cherrystudio/ui/hooks",
"lib": "@cherrystudio/ui/lib",
"ui": "@cherrystudio/ui/components/ui",
"utils": "@cherrystudio/ui/utils"
},
"iconLibrary": "lucide",
"rsc": false,

View File

@ -1,7 +1,6 @@
import type { RequireSome } from '@cherrystudio/ui/types'
import { addToast, closeAll, closeToast, getToastQueue, isToastClosing } from '@heroui/toast'
import type { RequireSome } from '@/types'
type AddToastProps = Parameters<typeof addToast>[0]
type ToastPropsColored = Omit<AddToastProps, 'color'>

View File

@ -90,3 +90,10 @@ export { Sortable } from './interactive/Sortable'
// Composite Components (复合组件)
// 暂无复合组件
// UI Components (shadcn)
export * from './ui/button'
export * from './ui/command'
export * from './ui/dialog'
export * from './ui/popover'
export * from './ui/shadcn-io/dropzone'

View File

@ -1,9 +1,8 @@
import { cn } from '@cherrystudio/ui/utils/index'
import { Slot } from '@radix-ui/react-slot'
import { cva, type VariantProps } from 'class-variance-authority'
import * as React from 'react'
import { cn } from '@/utils/index'
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{

View File

@ -1,10 +1,15 @@
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle
} from '@cherrystudio/ui/components/ui/dialog'
import { cn } from '@cherrystudio/ui/utils'
import { Command as CommandPrimitive } from 'cmdk'
import { SearchIcon } from 'lucide-react'
import * as React from 'react'
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { cn } from '@/utils/index'
function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
return (
<CommandPrimitive

View File

@ -1,9 +1,8 @@
import { cn } from '@cherrystudio/ui/utils/index'
import * as DialogPrimitive from '@radix-ui/react-dialog'
import { XIcon } from 'lucide-react'
import * as React from 'react'
import { cn } from '@/utils/index'
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />
}

View File

@ -1,10 +1,9 @@
'use client'
import { cn } from '@cherrystudio/ui/utils'
import * as PopoverPrimitive from '@radix-ui/react-popover'
import * as React from 'react'
import { cn } from '@/utils/index'
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
return <PopoverPrimitive.Root data-slot="popover" {...props} />
}

View File

@ -1,14 +1,13 @@
'use client'
import { Button } from '@cherrystudio/ui/components/ui/button'
import { cn } from '@cherrystudio/ui/utils/index'
import { UploadIcon } from 'lucide-react'
import type { ReactNode } from 'react'
import { createContext, use } from 'react'
import type { DropEvent, DropzoneOptions, FileRejection } from 'react-dropzone'
import { useDropzone } from 'react-dropzone'
import { Button } from '@/components/ui/button'
import { cn } from '@/utils/index'
type DropzoneContextType = {
src?: File[]
accept?: DropzoneOptions['accept']

View File

@ -13,9 +13,7 @@
"noFallthroughCasesInSwitch": true,
"outDir": "./dist",
"paths": {
"@/*": ["src/*"],
"@/types": ["src/types"],
"@/utils": ["src/utils"]
"@cherrystudio/ui/*": ["./src/*"]
},
"resolveJsonModule": true,
"rootDir": ".",

View File

@ -30,10 +30,8 @@
"@cherrystudio/ai-core": ["./packages/aiCore/src/index.ts"],
"@cherrystudio/extension-table-plus": ["./packages/extension-table-plus/src/index.ts"],
"@cherrystudio/ui": ["./packages/ui/src/index.ts"],
"@/components/*": ["./packages/ui/src/components/*"],
"@/utils/*": ["./packages/ui/src/utils/*"],
"@/types": ["./packages/ui/src/types/index.ts"],
"@/hooks/*": ["./packages/ui/src/hooks/*"]
"@cherrystudio/ui/*": ["./packages/ui/src/*"]
},
"experimentalDecorators": true,
"emitDecoratorMetadata": true,