From 5c240ab3631517c3ef9f52235e7b8dcc4153c04c Mon Sep 17 00:00:00 2001 From: Naiyuan Qing <145280634+NevilleQingNY@users.noreply.github.com> Date: Fri, 30 Jan 2026 08:32:01 +0800 Subject: [PATCH] refactor(web): update imports to use @multica/ui package Replace local UI component and utility imports with @multica/ui subpath imports. Remove old components/ui/ directory, lib/utils.ts, and globals.css. Configure postcss, next.config, and tsconfig for monorepo UI package consumption. Co-Authored-By: Claude Opus 4.5 --- apps/web/app/globals.css | 126 ---------- apps/web/app/layout.tsx | 2 +- apps/web/components.json | 14 +- apps/web/components/component-example.tsx | 20 +- apps/web/components/example.tsx | 2 +- apps/web/components/ui/alert-dialog.tsx | 175 ------------- apps/web/components/ui/badge.tsx | 48 ---- apps/web/components/ui/button.tsx | 53 ---- apps/web/components/ui/card.tsx | 94 ------- apps/web/components/ui/combobox.tsx | 293 ---------------------- apps/web/components/ui/dropdown-menu.tsx | 253 ------------------- apps/web/components/ui/field.tsx | 227 ----------------- apps/web/components/ui/input-group.tsx | 149 ----------- apps/web/components/ui/input.tsx | 20 -- apps/web/components/ui/label.tsx | 20 -- apps/web/components/ui/select.tsx | 192 -------------- apps/web/components/ui/separator.tsx | 25 -- apps/web/components/ui/textarea.tsx | 18 -- apps/web/lib/utils.ts | 6 - apps/web/next.config.ts | 2 +- apps/web/package.json | 14 +- apps/web/postcss.config.mjs | 8 +- apps/web/tsconfig.json | 3 +- 23 files changed, 25 insertions(+), 1739 deletions(-) delete mode 100644 apps/web/app/globals.css delete mode 100644 apps/web/components/ui/alert-dialog.tsx delete mode 100644 apps/web/components/ui/badge.tsx delete mode 100644 apps/web/components/ui/button.tsx delete mode 100644 apps/web/components/ui/card.tsx delete mode 100644 apps/web/components/ui/combobox.tsx delete mode 100644 apps/web/components/ui/dropdown-menu.tsx delete mode 100644 apps/web/components/ui/field.tsx delete mode 100644 apps/web/components/ui/input-group.tsx delete mode 100644 apps/web/components/ui/input.tsx delete mode 100644 apps/web/components/ui/label.tsx delete mode 100644 apps/web/components/ui/select.tsx delete mode 100644 apps/web/components/ui/separator.tsx delete mode 100644 apps/web/components/ui/textarea.tsx delete mode 100644 apps/web/lib/utils.ts diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css deleted file mode 100644 index abd65764..00000000 --- a/apps/web/app/globals.css +++ /dev/null @@ -1,126 +0,0 @@ -@import "tailwindcss"; -@import "tw-animate-css"; -@import "shadcn/tailwind.css"; - -@custom-variant dark (&:is(.dark *)); - -@theme inline { - --color-background: var(--background); - --color-foreground: var(--foreground); - --font-sans: var(--font-sans); - --font-mono: var(--font-geist-mono); - --color-sidebar-ring: var(--sidebar-ring); - --color-sidebar-border: var(--sidebar-border); - --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); - --color-sidebar-accent: var(--sidebar-accent); - --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); - --color-sidebar-primary: var(--sidebar-primary); - --color-sidebar-foreground: var(--sidebar-foreground); - --color-sidebar: var(--sidebar); - --color-chart-5: var(--chart-5); - --color-chart-4: var(--chart-4); - --color-chart-3: var(--chart-3); - --color-chart-2: var(--chart-2); - --color-chart-1: var(--chart-1); - --color-ring: var(--ring); - --color-input: var(--input); - --color-border: var(--border); - --color-destructive: var(--destructive); - --color-accent-foreground: var(--accent-foreground); - --color-accent: var(--accent); - --color-muted-foreground: var(--muted-foreground); - --color-muted: var(--muted); - --color-secondary-foreground: var(--secondary-foreground); - --color-secondary: var(--secondary); - --color-primary-foreground: var(--primary-foreground); - --color-primary: var(--primary); - --color-popover-foreground: var(--popover-foreground); - --color-popover: var(--popover); - --color-card-foreground: var(--card-foreground); - --color-card: var(--card); - --radius-sm: calc(var(--radius) - 4px); - --radius-md: calc(var(--radius) - 2px); - --radius-lg: var(--radius); - --radius-xl: calc(var(--radius) + 4px); - --radius-2xl: calc(var(--radius) + 8px); - --radius-3xl: calc(var(--radius) + 12px); - --radius-4xl: calc(var(--radius) + 16px); -} - -:root { - --background: oklch(1 0 0); - --foreground: oklch(0.141 0.005 285.823); - --card: oklch(1 0 0); - --card-foreground: oklch(0.141 0.005 285.823); - --popover: oklch(1 0 0); - --popover-foreground: oklch(0.141 0.005 285.823); - --primary: oklch(0.51 0.23 277); - --primary-foreground: oklch(0.96 0.02 272); - --secondary: oklch(0.967 0.001 286.375); - --secondary-foreground: oklch(0.21 0.006 285.885); - --muted: oklch(0.967 0.001 286.375); - --muted-foreground: oklch(0.552 0.016 285.938); - --accent: oklch(0.967 0.001 286.375); - --accent-foreground: oklch(0.21 0.006 285.885); - --destructive: oklch(0.577 0.245 27.325); - --border: oklch(0.92 0.004 286.32); - --input: oklch(0.92 0.004 286.32); - --ring: oklch(0.705 0.015 286.067); - --chart-1: oklch(0.79 0.10 275); - --chart-2: oklch(0.68 0.16 277); - --chart-3: oklch(0.59 0.20 277); - --chart-4: oklch(0.51 0.23 277); - --chart-5: oklch(0.46 0.21 277); - --radius: 0.625rem; - --sidebar: oklch(0.985 0 0); - --sidebar-foreground: oklch(0.141 0.005 285.823); - --sidebar-primary: oklch(0.51 0.23 277); - --sidebar-primary-foreground: oklch(0.96 0.02 272); - --sidebar-accent: oklch(0.967 0.001 286.375); - --sidebar-accent-foreground: oklch(0.21 0.006 285.885); - --sidebar-border: oklch(0.92 0.004 286.32); - --sidebar-ring: oklch(0.705 0.015 286.067); -} - -.dark { - --background: oklch(0.141 0.005 285.823); - --foreground: oklch(0.985 0 0); - --card: oklch(0.21 0.006 285.885); - --card-foreground: oklch(0.985 0 0); - --popover: oklch(0.21 0.006 285.885); - --popover-foreground: oklch(0.985 0 0); - --primary: oklch(0.59 0.20 277); - --primary-foreground: oklch(0.96 0.02 272); - --secondary: oklch(0.274 0.006 286.033); - --secondary-foreground: oklch(0.985 0 0); - --muted: oklch(0.274 0.006 286.033); - --muted-foreground: oklch(0.705 0.015 286.067); - --accent: oklch(0.274 0.006 286.033); - --accent-foreground: oklch(0.985 0 0); - --destructive: oklch(0.704 0.191 22.216); - --border: oklch(1 0 0 / 10%); - --input: oklch(1 0 0 / 15%); - --ring: oklch(0.552 0.016 285.938); - --chart-1: oklch(0.79 0.10 275); - --chart-2: oklch(0.68 0.16 277); - --chart-3: oklch(0.59 0.20 277); - --chart-4: oklch(0.51 0.23 277); - --chart-5: oklch(0.46 0.21 277); - --sidebar: oklch(0.21 0.006 285.885); - --sidebar-foreground: oklch(0.985 0 0); - --sidebar-primary: oklch(0.68 0.16 277); - --sidebar-primary-foreground: oklch(0.96 0.02 272); - --sidebar-accent: oklch(0.274 0.006 286.033); - --sidebar-accent-foreground: oklch(0.985 0 0); - --sidebar-border: oklch(1 0 0 / 10%); - --sidebar-ring: oklch(0.552 0.016 285.938); -} - -@layer base { - * { - @apply border-border outline-ring/50; - } - body { - @apply bg-background text-foreground; - } -} \ No newline at end of file diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index f05f7486..8c345796 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,6 +1,6 @@ import type { Metadata } from "next"; import { Geist, Geist_Mono, Inter } from "next/font/google"; -import "./globals.css"; +import "@multica/ui/globals.css"; const inter = Inter({subsets:['latin'],variable:'--font-sans'}); diff --git a/apps/web/components.json b/apps/web/components.json index 1800a5b3..eb352119 100644 --- a/apps/web/components.json +++ b/apps/web/components.json @@ -5,20 +5,18 @@ "tsx": true, "tailwind": { "config": "", - "css": "app/globals.css", + "css": "../../packages/ui/src/styles/globals.css", "baseColor": "zinc", - "cssVariables": true, - "prefix": "" + "cssVariables": true }, "iconLibrary": "hugeicons", "aliases": { "components": "@/components", - "utils": "@/lib/utils", - "ui": "@/components/ui", + "hooks": "@/hooks", "lib": "@/lib", - "hooks": "@/hooks" + "utils": "@multica/ui/lib/utils", + "ui": "@multica/ui/components" }, "menuColor": "default", - "menuAccent": "subtle", - "registries": {} + "menuAccent": "subtle" } diff --git a/apps/web/components/component-example.tsx b/apps/web/components/component-example.tsx index 67a85d71..47125245 100644 --- a/apps/web/components/component-example.tsx +++ b/apps/web/components/component-example.tsx @@ -17,9 +17,9 @@ import { AlertDialogMedia, AlertDialogTitle, AlertDialogTrigger, -} from "@/components/ui/alert-dialog" -import { Badge } from "@/components/ui/badge" -import { Button } from "@/components/ui/button" +} from "@multica/ui/components/alert-dialog" +import { Badge } from "@multica/ui/components/badge" +import { Button } from "@multica/ui/components/button" import { Card, CardAction, @@ -28,7 +28,7 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" +} from "@multica/ui/components/card" import { Combobox, ComboboxContent, @@ -36,7 +36,7 @@ import { ComboboxInput, ComboboxItem, ComboboxList, -} from "@/components/ui/combobox" +} from "@multica/ui/components/combobox" import { DropdownMenu, DropdownMenuCheckboxItem, @@ -53,9 +53,9 @@ import { DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu" -import { Field, FieldGroup, FieldLabel } from "@/components/ui/field" -import { Input } from "@/components/ui/input" +} from "@multica/ui/components/dropdown-menu" +import { Field, FieldGroup, FieldLabel } from "@multica/ui/components/field" +import { Input } from "@multica/ui/components/input" import { Select, SelectContent, @@ -63,8 +63,8 @@ import { SelectItem, SelectTrigger, SelectValue, -} from "@/components/ui/select" -import { Textarea } from "@/components/ui/textarea" +} from "@multica/ui/components/select" +import { Textarea } from "@multica/ui/components/textarea" import { HugeiconsIcon } from "@hugeicons/react" import { PlusSignIcon, BluetoothIcon, MoreVerticalCircle01Icon, FileIcon, FolderIcon, FolderOpenIcon, CodeIcon, MoreHorizontalCircle01Icon, SearchIcon, FloppyDiskIcon, DownloadIcon, EyeIcon, LayoutIcon, PaintBoardIcon, SunIcon, MoonIcon, ComputerIcon, UserIcon, CreditCardIcon, SettingsIcon, KeyboardIcon, LanguageCircleIcon, NotificationIcon, MailIcon, ShieldIcon, HelpCircleIcon, File01Icon, LogoutIcon } from "@hugeicons/core-free-icons" diff --git a/apps/web/components/example.tsx b/apps/web/components/example.tsx index 78834926..6b8ff86a 100644 --- a/apps/web/components/example.tsx +++ b/apps/web/components/example.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@multica/ui/lib/utils" function ExampleWrapper({ className, ...props }: React.ComponentProps<"div">) { return ( diff --git a/apps/web/components/ui/alert-dialog.tsx b/apps/web/components/ui/alert-dialog.tsx deleted file mode 100644 index ee099f84..00000000 --- a/apps/web/components/ui/alert-dialog.tsx +++ /dev/null @@ -1,175 +0,0 @@ -"use client" - -import * as React from "react" -import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog" - -import { cn } from "@/lib/utils" -import { Button } from "@/components/ui/button" - -function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) { - return -} - -function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) { - return ( - - ) -} - -function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props) { - return ( - - ) -} - -function AlertDialogOverlay({ - className, - ...props -}: AlertDialogPrimitive.Backdrop.Props) { - return ( - - ) -} - -function AlertDialogContent({ - className, - size = "default", - ...props -}: AlertDialogPrimitive.Popup.Props & { - size?: "default" | "sm" -}) { - return ( - - - - - ) -} - -function AlertDialogHeader({ - className, - ...props -}: React.ComponentProps<"div">) { - return ( -
- ) -} - -function AlertDialogFooter({ - className, - ...props -}: React.ComponentProps<"div">) { - return ( -
- ) -} - -function AlertDialogMedia({ - className, - ...props -}: React.ComponentProps<"div">) { - return ( -
- ) -} - -function AlertDialogTitle({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} - -function AlertDialogDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} - -function AlertDialogAction({ - className, - ...props -}: React.ComponentProps) { - return ( -