{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "invoice-generator-dashboard",
  "dependencies": [
    "@radix-ui/react-dialog",
    "@radix-ui/react-dropdown-menu",
    "@radix-ui/react-label",
    "@radix-ui/react-select",
    "@radix-ui/react-separator",
    "@radix-ui/react-slot",
    "@radix-ui/react-tooltip",
    "class-variance-authority",
    "lucide-react",
    "next-themes"
  ],
  "registryDependencies": [
    "breadcrumb",
    "button",
    "dialog",
    "dropdown-menu",
    "input",
    "label",
    "popover",
    "select",
    "separator",
    "sheet",
    "sidebar",
    "skeleton",
    "textarea",
    "tooltip",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/components/app-sidebar.tsx",
      "content": "\"use client\";\nimport * as React from \"react\";\nimport {\n  Plus,\n  Send,\n  X\n} from \"lucide-react\";\n\nimport { SearchForm } from \"./search-form\";\nimport {\n  Sidebar,\n  SidebarContent,\n  SidebarGroup,\n  SidebarGroupContent,\n  SidebarGroupLabel,\n  SidebarHeader,\n  SidebarMenu,\n  SidebarMenuButton,\n  SidebarMenuItem,\n  SidebarRail,\n} from \"@/components/ui/sidebar\";\nimport {\n  Dialog,\n  DialogContent,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Button } from \"@/components/ui/button\";\nimport { Textarea } from \"@/components/ui/textarea\";\n\nimport { sidebarData } from \"../data\";\n\ninterface AppSidebarProps extends React.ComponentProps<typeof Sidebar> {\n  onNavigate?: (view: string) => void;\n  currentView?: string;\n}\n\nexport function AppSidebar({ onNavigate, currentView, ...props }: AppSidebarProps) {\n  return (\n    <Sidebar {...props} className=\"px-4 md:px-2\">\n      <SidebarHeader className=\"border-b px-2 md:px-0 border-border\">\n        <Dialog>\n          <DialogTrigger asChild>\n            <SidebarMenuButton\n              className=\"\n                flex items-center justify-center gap-2 px-8 py-3 font-sans text-base font-medium text-white/90 hover:text-white tracking-tight rounded-xl h-12 bg-linear-to-b from-[#279596] to-[#318A8B] shadow-[inset_0_4px_6px_rgba(255,255,255,0.4),inset_0_-4px_6px_rgba(255,255,255,0.2),inset_0_0_0_1px_rgba(255,255,255,0.1)] transition-colors duration-300 ease-in-out cursor-pointer active:text-white\n              \"\n            >\n              <Plus className=\"size-6\" strokeWidth={2.5} />\n              <span>Compose Email</span>\n            </SidebarMenuButton>\n          </DialogTrigger>\n          <DialogContent className=\"sm:max-w-[525px] p-0 overflow-hidden bg-background border-border shadow-xl\">\n            <DialogHeader className=\"px-6 py-4 border-b border-border bg-muted/30\">\n              <DialogTitle className=\"text-lg font-semibold tracking-tight text-foreground\">New Message</DialogTitle>\n            </DialogHeader>\n            <div className=\"flex flex-col\">\n              <div className=\"flex items-center border-b border-border px-4 py-2 hover:bg-muted/10 transition-colors\">\n                <span className=\"text-sm font-medium text-muted-foreground w-12 shrink-0\">To:</span>\n                <Input \n                  className=\"border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none h-8 px-2 text-sm text-foreground placeholder:text-muted-foreground/50 rounded-none bg-transparent\" \n                  placeholder=\"recipient@example.com\"\n                  autoFocus\n                />\n              </div>\n              <div className=\"flex items-center border-b border-border px-4 py-2 hover:bg-muted/10 transition-colors\">\n                <span className=\"text-sm font-medium text-muted-foreground w-12 shrink-0\">Subject:</span>\n                <Input \n                  className=\"border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none h-8 px-4 text-sm text-foreground placeholder:text-muted-foreground/50 rounded-none bg-transparent\" \n                  placeholder=\"Enter subject\" \n                />\n              </div>\n              <div className=\"p-4\">\n                <Textarea \n                  className=\"min-h-[250px] border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none resize-none px-2 text-sm text-foreground placeholder:text-muted-foreground/50 rounded-none bg-transparent\" \n                  placeholder=\"Write your message here...\"\n                />\n              </div>\n              <div className=\"flex items-center justify-between border-t border-border px-6 py-4 bg-muted/10\">\n                <Button variant=\"ghost\" className=\"h-9 px-4 text-muted-foreground hover:text-foreground\">\n                  <X className=\"size-4 \" />\n                  Discard\n                </Button>\n                <div className=\"flex gap-2\">\n                  <DialogTrigger asChild>\n                    <Button variant=\"outline\" className=\"h-9 px-4\">Save Draft</Button>\n                  </DialogTrigger>\n                  <Button className=\"h-9 px-5 bg-[#279596] hover:bg-[#207e7f] text-white tracking-tight font-medium shadow-sm transition-colors\">\n                    <Send className=\"size-4\" />\n                    Send\n                  </Button>\n                </div>\n              </div>\n            </div>\n          </DialogContent>\n        </Dialog>\n      </SidebarHeader>\n      <SidebarContent className=\"pt-2 px-2 md:px-0\">\n        <SearchForm />\n        {sidebarData.navMain.map((item) => (\n          <SidebarGroup key={item.title} className=\"px-2 md:px-0 border-b-[1.5px] border-border\">\n            <SidebarGroupLabel className=\"text-[15px] -ml-1.5 text-muted-foreground tracking-tight\">{item.title}</SidebarGroupLabel>\n            <SidebarGroupContent>\n              <SidebarMenu>\n                {item.items.map((subItem) => (\n                  <SidebarMenuItem key={subItem.title}>\n                    <SidebarMenuButton\n                      asChild\n                      isActive={currentView === subItem.title}\n                      disabled={subItem.isDisabled}\n                      className=\"h-10 text-[15px] text-muted-foreground/90 data-[active=true]:bg-accent data-[active=true]:text-teal-800 dark:data-[active=true]:text-teal-400 rounded-lg data-[active=true]:border-[1.5px] data-[active=true]:border-border tracking-tight hover:text-teal-800 dark:hover:text-teal-400 disabled:opacity-50 disabled:cursor-not-allowed pl-3\"\n                    >\n                      <a\n                        href={subItem.url}\n                        onClick={(e) => {\n                          if (subItem.isDisabled) {\n                            e.preventDefault();\n                            return;\n                          }\n                          if (onNavigate) {\n                            e.preventDefault();\n                            onNavigate(subItem.title);\n                            return;\n                          }\n                        }}\n                      >\n                        {subItem.icon && (\n                          <subItem.icon className=\"size-5\" strokeWidth={2.5} />\n                        )}\n                        <span className=\"font-medium \">{subItem.title}</span>\n                      </a>\n                    </SidebarMenuButton>\n                  </SidebarMenuItem>\n                ))}\n              </SidebarMenu>\n            </SidebarGroupContent>\n          </SidebarGroup>\n        ))}\n      </SidebarContent>\n      <SidebarRail />\n    </Sidebar>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/components/app-sidebar.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/components/mode-toggle.tsx",
      "content": "\"use client\";\n\nimport { Moon, Sun } from \"lucide-react\";\nimport { useTheme } from \"next-themes\";\nimport { Button } from \"@/components/ui/button\";\n\nexport function ModeToggle() {\n    const { theme, setTheme } = useTheme();\n\n    return (\n        <Button\n            variant=\"ghost\"\n            size=\"icon\"\n            className=\"size-9 rounded-lg border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors\"\n            onClick={() => setTheme(theme === \"light\" ? \"dark\" : \"light\")}\n        >\n            <Sun className=\"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0\" />\n            <Moon className=\"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n            <span className=\"sr-only\">Toggle theme</span>\n        </Button>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/components/mode-toggle.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/components/search-form.tsx",
      "content": "import { Search } from \"lucide-react\"\n\nimport { Label } from \"@/components/ui/label\"\nimport {\n  SidebarGroup,\n  SidebarGroupContent,\n  SidebarInput,\n} from \"@/components/ui/sidebar\"\n\nexport function SearchForm({ ...props }: React.ComponentProps<\"form\">) {\n  return (\n    <form {...props}>\n      <SidebarGroup className=\"py-0 px-0\">\n        <SidebarGroupContent className=\"relative \">\n          <Label htmlFor=\"search\" className=\"sr-only\">\n            Search\n          </Label>\n          <SidebarInput\n            id=\"search\"\n            placeholder=\"Search Anything\"\n            className=\"pl-10 h-12 placeholder:text-muted-foreground text-foreground tracking-tight placeholder:text-[15px] bg-secondary/50 rounded-xl border-border focus-visible:ring-0!\"\n          />\n          <Search className=\"pointer-events-none absolute top-1/2 left-3 size-5 -translate-y-1/2 opacity-50 select-none\" />\n        </SidebarGroupContent>\n      </SidebarGroup>\n    </form>\n  )\n}",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/components/search-form.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/components/site-header.tsx",
      "content": "\"use client\";\n\nimport {\n  Breadcrumb,\n  BreadcrumbItem,\n  BreadcrumbLink,\n  BreadcrumbList,\n} from \"@/components/ui/breadcrumb\";\nimport { Button } from \"@/components/ui/button\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { SidebarTrigger } from \"@/components/ui/sidebar\";\nimport { Eye, EyeOff, Save, Send } from \"lucide-react\";\nimport { ModeToggle } from \"./mode-toggle\";\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/components/ui/popover\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\n\nexport const SiteHeader = ({\n  currentView,\n  onTogglePreview,\n  isPreviewHidden\n}: {\n  currentView?: string;\n  onTogglePreview?: () => void;\n  isPreviewHidden?: boolean;\n}) => {\n  return (\n    <header className=\"flex h-16 shrink-0 items-center justify-between gap-2 border-b px-4\">\n      <div className=\"flex items-center gap-2\">\n        <SidebarTrigger className=\"-ml-1\" />\n        <Separator orientation=\"vertical\" className=\"mr-2 h-4\" />\n        <Breadcrumb>\n          <BreadcrumbList>\n            <BreadcrumbItem className=\"hidden md:block\">\n              <BreadcrumbLink\n                href=\"#\"\n                className=\"text-xl text-foreground font-semibold\"\n              >\n                {currentView}\n              </BreadcrumbLink>\n            </BreadcrumbItem>\n          </BreadcrumbList>\n        </Breadcrumb>\n      </div>\n      <div className=\"flex items-center gap-2 py-5\">\n        <ModeToggle />\n        <Button\n          className=\"group h-9 rounded-lg text-muted-foreground tracking-tight border-border shadow-none bg-background hidden lg:flex transition-colors duration-300 hover:shadow-sm\"\n          variant=\"outline\"\n          onClick={onTogglePreview}\n        >\n          {isPreviewHidden ? (\n            <>\n              <Eye className=\"size-4 transition-transform duration-300 group-hover:scale-110\" />\n              Show preview\n            </>\n          ) : (\n            <>\n              <EyeOff className=\"size-4 transition-transform duration-300 group-hover:scale-110\" />\n              Hide preview\n            </>\n          )}\n        </Button>\n        <Popover>\n          <PopoverTrigger asChild>\n            <Button\n              className=\"group h-9 rounded-lg text-muted-foreground tracking-tight border-border shadow-none bg-background hidden sm:flex transition-colors duration-300 hover:shadow-sm\"\n              variant=\"outline\"\n            >\n              <Save className=\"size-4 transition-transform duration-300 group-hover:scale-110\" />\n              Save as Draft\n            </Button>\n          </PopoverTrigger>\n          <PopoverContent className=\"w-56 p-4\">\n            <div className=\"flex flex-col gap-2\">\n              <h4 className=\"font-medium leading-none tracking-tight\">Draft Saved</h4>\n              <p className=\"text-sm text-muted-foreground\">\n                Your invoice has been saved as a draft locally.\n              </p>\n            </div>\n          </PopoverContent>\n        </Popover>\n\n        <Dialog>\n          <DialogTrigger asChild>\n            <Button className=\"group h-9 rounded-lg px-3 sm:px-4 tracking-tight border-[1.5px] bg-neutral-900 text-white/90 font-medium text-sm shadow-[inset_0_4px_6px_rgba(255,255,255,0.4),inset_0_-4px_6px_rgba(255,255,255,0.2),inset_0_0_0_1px_rgba(255,255,255,0.1)] border-none dark:bg-neutral-800 hover:bg-neutral-800 dark:hover:bg-neutral-700 transition-colors duration-300 hover:shadow-lg\">\n              <Send className=\"size-4 transition-transform duration-300 group-hover:translate-x-0.5 group-hover:-translate-y-0.5\" />\n              <span className=\"hidden sm:inline\">Send Invoice</span>\n            </Button>\n          </DialogTrigger>\n          <DialogContent\n            className=\"sm:max-w-[425px]\"\n            onOpenAutoFocus={(e) => e.preventDefault()}\n          >\n            <DialogHeader>\n              <DialogTitle>Send Invoice</DialogTitle>\n              <DialogDescription>\n                Review the details below before sending this invoice to the client.\n              </DialogDescription>\n            </DialogHeader>\n            <div className=\"grid gap-4 py-4\">\n              <div className=\"grid gap-2\">\n                <Label htmlFor=\"email\">Client Email</Label>\n                <Input id=\"email\" defaultValue=\"client@email.com\" />\n              </div>\n              <div className=\"grid gap-2\">\n                <Label htmlFor=\"subject\">Subject Line</Label>\n                <Input id=\"subject\" defaultValue=\"Invoice INV-0001 from Your Company\" />\n              </div>\n            </div>\n            <div className=\"flex justify-end\">\n              <Button type=\"submit\" className=\"bg-neutral-900 border-none dark:bg-neutral-800 hover:bg-neutral-800 dark:hover:bg-neutral-700 text-white\">Confirm & Send</Button>\n            </div>\n          </DialogContent>\n        </Dialog>\n      </div>\n    </header>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/components/site-header.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/components/version-switcher.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Check, ChevronsUpDown, GalleryVerticalEnd } from \"lucide-react\"\n\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\"\nimport {\n  SidebarMenu,\n  SidebarMenuButton,\n  SidebarMenuItem,\n} from \"@/components/ui/sidebar\"\n\nexport function VersionSwitcher({\n  versions,\n  defaultVersion,\n}: {\n  versions: string[]\n  defaultVersion: string\n}) {\n  const [selectedVersion, setSelectedVersion] = React.useState(defaultVersion)\n\n  return (\n    <SidebarMenu>\n      <SidebarMenuItem>\n        <DropdownMenu>\n          <DropdownMenuTrigger asChild>\n            <SidebarMenuButton\n              size=\"lg\"\n              className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n            >\n              <div className=\"bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg\">\n                <GalleryVerticalEnd className=\"size-4\" />\n              </div>\n              <div className=\"flex flex-col gap-0.5 leading-none\">\n                <span className=\"font-medium\">Documentation</span>\n                <span className=\"\">v{selectedVersion}</span>\n              </div>\n              <ChevronsUpDown className=\"ml-auto\" />\n            </SidebarMenuButton>\n          </DropdownMenuTrigger>\n          <DropdownMenuContent\n            className=\"w-(--radix-dropdown-menu-trigger-width)\"\n            align=\"start\"\n          >\n            {versions.map((version) => (\n              <DropdownMenuItem\n                key={version}\n                onSelect={() => setSelectedVersion(version)}\n              >\n                v{version}{\" \"}\n                {version === selectedVersion && <Check className=\"ml-auto\" />}\n              </DropdownMenuItem>\n            ))}\n          </DropdownMenuContent>\n        </DropdownMenu>\n      </SidebarMenuItem>\n    </SidebarMenu>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/components/version-switcher.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/dashboardLayout.tsx",
      "content": "import { AppSidebar } from \"./components/app-sidebar\";\nimport { SidebarInset, SidebarProvider } from \"@/components/ui/sidebar\";\nimport { SiteHeader } from \"./components/site-header\";\n\nexport const DashboardLayout = ({\n  children,\n  onNavigate,\n  currentView,\n  onTogglePreview,\n  isPreviewHidden\n}: {\n  children: React.ReactNode;\n  onNavigate?: (view: string) => void;\n  currentView?: string;\n  onTogglePreview?: () => void;\n  isPreviewHidden?: boolean;\n}) => {\n  return (\n    <SidebarProvider>\n      <AppSidebar onNavigate={onNavigate} currentView={currentView} />\n      <SidebarInset>\n        <SiteHeader\n          currentView={currentView}\n          onTogglePreview={onTogglePreview}\n          isPreviewHidden={isPreviewHidden}\n        />\n        <main className=\"flex-1\">\n          {children}\n        </main>\n      </SidebarInset>\n    </SidebarProvider>\n  );\n};",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/dashboardLayout.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/data.ts",
      "content": "import {\n  ReceiptText,\n  Inbox,\n  Star,\n  Send,\n  FileText,\n  Calendar,\n  Archive,\n  AlertCircle,\n  Trash,\n  Tag,\n} from \"lucide-react\";\n\nexport const initialInvoice = {\n  invoiceNumber: \"INV-0231\",\n  billedByName: \"John Jacobs\",\n  billedByEmail: \"hijacob@gmail.com\",\n  billedByAddress: \"123 Maple Street, Springfield\",\n  billedToCompany: \"Acme Corp.\",\n  billedToEmail: \"hi@acmecorp.com\",\n  billedToAddress: \"321 Apple Street, Autumfield\",\n  dateIssued: \"Jul 28, 2025\",\n  dueDate: \"Jul 31, 2025\",\n  items: [{ description: \"Website Design\", qty: 1, cost: 49.0, total: 49.0 }],\n  currency: \"USD\",\n};\n\nexport const sidebarData = {\n  navMain: [\n    {\n      title: \"General\",\n      items: [\n        {\n          title: \"Invoice\",\n          icon: ReceiptText,\n          url: \"/invoice\",\n          isActive: true,\n        },\n        {\n          title: \"Inbox\",\n          icon: Inbox,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Starred\",\n          icon: Star,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Sent\",\n          icon: Send,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Drafts\",\n          icon: FileText,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Scheduled\",\n          icon: Calendar,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Archive\",\n          icon: Archive,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Spam\",\n          icon: AlertCircle,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Trash\",\n          icon: Trash,\n          url: \"#\",\n          isDisabled: true,\n        },\n      ],\n    },\n    {\n      title: \"Labels\",\n      items: [\n        {\n          title: \"Marketing\",\n          icon: Tag,\n          url: \"#\",\n          isDisabled: true,\n        },\n        {\n          title: \"Sales\",\n          icon: Tag,\n          url: \"#\",\n          isDisabled: true,\n        },\n      ],\n    },\n  ],\n};\n",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/data.ts"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/demo.tsx",
      "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { DashboardLayout } from \"./dashboardLayout\";\nimport { InvoiceView } from \"./invoicePageView\";\n\nexport default function InvoiceGeneratorDashboardDemo() {\n    const [currentView, setCurrentView] = useState(\"Invoice\");\n    const [isPreviewHidden, setIsPreviewHidden] = useState(false);\n\n    const renderContent = () => {\n        switch (currentView) {\n            case \"Invoice\":\n                return <InvoiceView isPreviewHidden={isPreviewHidden} />;\n            default:\n                return <InvoiceView isPreviewHidden={isPreviewHidden} />;\n        }\n    };\n\n    return (\n        <DashboardLayout\n            onNavigate={setCurrentView}\n            currentView={currentView}\n            onTogglePreview={() => setIsPreviewHidden(!isPreviewHidden)}\n            isPreviewHidden={isPreviewHidden}\n        >\n            {renderContent()}\n        </DashboardLayout>\n    );\n}",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/demo.tsx"
    },
    {
      "path": "src/components/dashboards/invoice-generator-dashboard/invoicePageView.tsx",
      "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/components/ui/select\";\nimport { cn } from \"@/lib/utils\";\nimport { useState } from \"react\";\nimport { initialInvoice } from \"./data\";\n\nexport const InvoiceView = ({ isPreviewHidden }: { isPreviewHidden?: boolean }) => {\n  const [view, setView] = useState(\"form\");\n  const [invoice, setInvoice] = useState(initialInvoice);\n\n  interface InvoiceItem {\n    description: string;\n    qty: number;\n    cost: number;\n    total: number;\n  }\n\n  interface Invoice {\n    invoiceNumber: string;\n    billedByName: string;\n    billedByEmail: string;\n    billedByAddress: string;\n    billedToCompany: string;\n    billedToEmail: string;\n    billedToAddress: string;\n    dateIssued: string;\n    dueDate: string;\n    items: InvoiceItem[];\n    currency: string;\n  }\n\n  const handleInputChange = (field: keyof Invoice, value: string): void => {\n    setInvoice((prev: Invoice) => ({\n      ...prev,\n      [field]: value,\n    }));\n  };\n\n  const handleItemChange = (\n    index: number,\n    field: keyof InvoiceItem,\n    value: string\n  ): void => {\n    const updatedItems = [...invoice.items];\n    updatedItems[index] = {\n      ...updatedItems[index],\n      [field]: field === \"description\" ? value : parseFloat(value) || 0,\n    };\n    // Auto-calculate total\n    if (field === \"qty\" || field === \"cost\") {\n      updatedItems[index].total =\n        updatedItems[index].qty * updatedItems[index].cost;\n    }\n    setInvoice((prev: Invoice) => ({\n      ...prev,\n      items: updatedItems,\n    }));\n  };\n\n  const addItem = () => {\n    setInvoice((prev) => ({\n      ...prev,\n      items: [...prev.items, { description: \"\", qty: 1, cost: 0, total: 0 }],\n    }));\n  };\n\n  const subtotal = invoice.items.reduce((sum, item) => sum + item.total, 0);\n\n  return (\n    <div className=\"flex flex-col lg:h-[calc(100vh-4rem)] w-full px-2 py-4 lg:overflow-hidden\">\n      {/* View Switcher for Mobile/Tablet */}\n      <div className=\"lg:hidden mb-4\">\n        <Select value={view} onValueChange={setView}>\n          <SelectTrigger className=\"w-full h-10 bg-background dark:bg-card shadow-none font-medium border-border hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors\">\n            <SelectValue placeholder=\"Select View\" />\n          </SelectTrigger>\n          <SelectContent>\n            <SelectItem value=\"form\">Edit Invoice Form</SelectItem>\n            <SelectItem value=\"preview\">Live Invoice Preview</SelectItem>\n          </SelectContent>\n        </Select>\n      </div>\n\n      <div className=\"flex flex-col lg:flex-row gap-6 h-full w-full lg:overflow-hidden\">\n        {/* Left Side - Form */}\n        <div\n          className={cn(\n            \"p-4 border-[1.5px] rounded-lg lg:overflow-y-auto scrollbar-hide bg-card border-border\",\n            // On mobile (lg:hidden), if view isn't 'form', hide this. \n            // On desktop (lg:block), if isPreviewHidden is true, center and set width. Otherwise fill available space.\n            view !== \"form\" && \"hidden lg:block\",\n            view === \"form\" && \"block lg:flex-1\",\n            isPreviewHidden ? \"lg:w-[60%] lg:mx-auto lg:block\" : \"lg:flex-1\"\n          )}\n        >\n          <div className=\"space-y-6\">\n            {/* Header Section */}\n            <div>\n              <h3 className=\"font-semibold mb-3 text-foreground/90 tracking-tight\">\n                Invoice Number\n              </h3>\n              <Input\n                value={invoice.invoiceNumber}\n                onChange={(e) =>\n                  handleInputChange(\"invoiceNumber\", e.target.value)\n                }\n                placeholder=\"INV-0001\"\n                className=\"h-10 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none\"\n              />\n            </div>\n\n\n            {/* Client Details */}\n            <div>\n              <h3 className=\"font-semibold mb-3 text-foreground/90 tracking-tight\">\n                Billed By\n              </h3>\n              <div className=\"space-y-3 p-3 rounded-xl border border-border bg-background/30 px-4 py-4 hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors duration-300 shadow-none\">\n                <div>\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Name\n                  </label>\n                  <Input\n                    value={invoice.billedByName}\n                    onChange={(e) =>\n                      handleInputChange(\"billedByName\", e.target.value)\n                    }\n                    placeholder=\"Your Name\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n                <div>\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Email\n                  </label>\n                  <Input\n                    value={invoice.billedByEmail}\n                    onChange={(e) =>\n                      handleInputChange(\"billedByEmail\", e.target.value)\n                    }\n                    placeholder=\"email@email.com\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n                <div>\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Address\n                  </label>\n                  <Input\n                    value={invoice.billedByAddress}\n                    onChange={(e) =>\n                      handleInputChange(\"billedByAddress\", e.target.value)\n                    }\n                    placeholder=\"Street Address\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n              </div>\n            </div>\n\n            {/* Billed To */}\n            <div>\n              <h3 className=\"font-semibold mb-3 text-foreground/90 tracking-tight\">\n                Billed To\n              </h3>\n              <div className=\"space-y-3 p-3 rounded-xl border border-border bg-background/30 px-4 py-4 hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors duration-300 shadow-none\">\n                <div>\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Company\n                  </label>\n                  <Input\n                    value={invoice.billedToCompany}\n                    onChange={(e) =>\n                      handleInputChange(\"billedToCompany\", e.target.value)\n                    }\n                    placeholder=\"Client Company\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n                <div>\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Email\n                  </label>\n                  <Input\n                    value={invoice.billedToEmail}\n                    onChange={(e) =>\n                      handleInputChange(\"billedToEmail\", e.target.value)\n                    }\n                    placeholder=\"client@email.com\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n                <div>\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Address\n                  </label>\n                  <Input\n                    value={invoice.billedToAddress}\n                    onChange={(e) =>\n                      handleInputChange(\"billedToAddress\", e.target.value)\n                    }\n                    placeholder=\"Street Address\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n              </div>\n            </div>\n\n            {/* Dates */}\n            <div>\n              <h3 className=\"font-semibold mb-3 text-foreground/90 tracking-tight\">\n                Dates\n              </h3>\n              <div className=\"grid grid-cols-2 gap-3\">\n                <div className=\"bg-background/30 rounded-xl border border-border p-3 hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors duration-300 shadow-none\">\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Date Issued\n                  </label>\n                  <Input\n                    value={invoice.dateIssued}\n                    onChange={(e) =>\n                      handleInputChange(\"dateIssued\", e.target.value)\n                    }\n                    placeholder=\"Date\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n                <div className=\"bg-background/30 rounded-xl border border-border p-3 hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors duration-300 shadow-none\">\n                  <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                    Due Date\n                  </label>\n                  <Input\n                    value={invoice.dueDate}\n                    onChange={(e) =>\n                      handleInputChange(\"dueDate\", e.target.value)\n                    }\n                    placeholder=\"Date\"\n                    className=\"h-9 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                  />\n                </div>\n              </div>\n            </div>\n\n            {/* Items */}\n            <div>\n              <h3 className=\"font-semibold mb-3 text-foreground/90 tracking-tight\">\n                Invoice Items\n              </h3>\n              <div className=\"space-y-3\">\n                {invoice.items.map((item, index) => (\n                  <div key={index} className=\"border border-border bg-background/30 rounded-xl p-4 space-y-3 hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors duration-300 shadow-none\">\n                    <div className=\"space-y-1\">\n                      <label className=\"text-xs text-muted-foreground block font-medium\">Description</label>\n                      <Input\n                        value={item.description}\n                        onChange={(e) =>\n                          handleItemChange(index, \"description\", e.target.value)\n                        }\n                        placeholder=\"Item description\"\n                        className=\"h-9 text-sm focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                      />\n                    </div>\n                    <div className=\"grid grid-cols-3 gap-3\">\n                      <div>\n                        <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                          Qty\n                        </label>\n                        <Input\n                          type=\"number\"\n                          value={item.qty}\n                          onChange={(e) =>\n                            handleItemChange(index, \"qty\", e.target.value)\n                          }\n                          className=\"h-9 text-sm focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                        />\n                      </div>\n                      <div>\n                        <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                          Cost\n                        </label>\n                        <Input\n                          type=\"number\"\n                          value={item.cost}\n                          onChange={(e) =>\n                            handleItemChange(index, \"cost\", e.target.value)\n                          }\n                          className=\"h-9 text-sm focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                        />\n                      </div>\n                      <div>\n                        <label className=\"text-xs text-muted-foreground mb-1 block font-medium\">\n                          Total\n                        </label>\n                        <Input\n                          type=\"number\"\n                          value={item.total.toFixed(2)}\n                          readOnly\n                          className=\"h-9 text-sm bg-muted/50 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-neutral-400 dark:focus-visible:border-neutral-600 outline-none shadow-none text-foreground\"\n                        />\n                      </div>\n                    </div>\n                  </div>\n                ))}\n                <Button\n                  onClick={addItem}\n                  variant=\"outline\"\n                  className=\"w-full h-10 text-sm rounded-xl border-dashed border-[1.5px] border-border bg-background/50 hover:bg-muted/50 hover:border-neutral-300 dark:hover:border-neutral-700 hover:shadow-sm transition-colors duration-300 cursor-pointer\"\n                >\n                  + Add Item\n                </Button>\n              </div>\n            </div>\n          </div>\n        </div>\n\n        <div\n          className={cn(\n            \"h-fit lg:h-full bg-muted/50 dark:bg-neutral-950/40 rounded-xl border-[1.5px] border-border lg:overflow-y-auto custom-scrollbar\",\n            // Mobile toggle logic\n            view !== \"preview\" && \"hidden lg:block\",\n            // Desktop hide logic\n            isPreviewHidden ? \"lg:hidden\" : \"lg:flex-1\"\n          )}\n        >\n          <div className=\"w-full min-h-full h-fit flex justify-center p-4 sm:p-8 lg:p-10\">\n            <div\n              className=\"relative bg-white dark:bg-neutral-900 rounded-lg p-6 lg:p-10 border-[1.5px] border-border w-full lg:max-w-4xl h-fit shadow-2xl shadow-neutral-200/50 dark:shadow-neutral-950/50 flex flex-col justify-between lg:origin-top lg:scale-[0.95] 2xl:scale-100 transform transition-transform duration-300\"\n              style={{\n                clipPath:\n                  \"polygon(0 0, calc(100% - 40px) 0, 100% 40px, 100% 100%, 0 100%)\",\n              }}\n            >\n              <div\n                className=\"absolute top-0 right-0 w-[40px] h-[40px] rounded-bl-xl bg-neutral-50 dark:bg-neutral-800 border-border border-l-[1.5px] border-b-[1.5px]\"\n              ></div>\n              <div>\n                <div className=\"mb-6 sm:mb-8\">\n                  <h1 className=\"text-2xl lg:text-4xl font-semibold text-foreground mb-1 tracking-tight\">\n                    Invoice\n                  </h1>\n                  <div className=\"grid grid-cols-2 gap-4 sm:gap-8 my-4 font-semibold\">\n                    <span className=\"text-muted-foreground tracking-tight text-xs lg:text-sm\">\n                      Invoice Number\n                    </span>\n                    <span className=\"text-xs lg:text-sm font-bold text-foreground\">\n                      {invoice.invoiceNumber}\n                    </span>\n                  </div>\n                </div>\n\n                <div className=\"grid grid-cols-2 gap-4 sm:gap-8 mb-6 sm:mb-8\">\n                  <div>\n                    <h3 className=\"text-xs lg:text-sm font-semibold text-muted-foreground mb-2 sm:mb-3\">\n                      Billed by:\n                    </h3>\n                    <div className=\"text-[10px] lg:text-sm leading-relaxed\">\n                      <p className=\"font-semibold text-foreground\">\n                        {invoice.billedByName}\n                      </p>\n                      <p className=\"text-muted-foreground\">{invoice.billedByEmail}</p>\n                      <p className=\"text-muted-foreground\">\n                        {invoice.billedByAddress}\n                      </p>\n                    </div>\n                  </div>\n                  <div>\n                    <h3 className=\"text-xs lg:text-sm font-semibold text-muted-foreground mb-2 sm:mb-3\">\n                      Billed to:\n                    </h3>\n                    <div className=\"text-[10px] lg:text-sm leading-relaxed\">\n                      <p className=\"font-semibold text-foreground\">\n                        {invoice.billedToCompany}\n                      </p>\n                      <p className=\"text-muted-foreground\">{invoice.billedToEmail}</p>\n                      <p className=\"text-muted-foreground\">\n                        {invoice.billedToAddress}\n                      </p>\n                    </div>\n                  </div>\n                </div>\n\n                <div className=\"grid grid-cols-2 gap-4 sm:gap-8 mb-6 sm:mb-8\">\n                  <div>\n                    <h3 className=\"text-xs lg:text-sm font-semibold text-muted-foreground mb-1 sm:mb-2\">\n                      Date Issued:\n                    </h3>\n                    <p className=\"text-foreground font-medium text-[10px] lg:text-sm\">\n                      {invoice.dateIssued}\n                    </p>\n                  </div>\n                  <div>\n                    <h3 className=\"text-xs lg:text-sm font-semibold text-muted-foreground mb-1 sm:mb-2\">\n                      Due Date:\n                    </h3>\n                    <p className=\"text-foreground font-medium text-[10px] lg:text-sm\">\n                      {invoice.dueDate}\n                    </p>\n                  </div>\n                </div>\n\n                {/* Items Table */}\n                <div className=\"mb-6 sm:mb-8\">\n                  <table className=\"w-full\">\n                    <thead>\n                      <tr className=\"border-b border-border\">\n                        <th className=\"text-left text-[10px] lg:text-sm font-semibold text-muted-foreground pb-2\">\n                          Item\n                        </th>\n                        <th className=\"text-center text-[10px] lg:text-sm font-semibold text-muted-foreground pb-2\">\n                          QTY\n                        </th>\n                        <th className=\"text-right text-[10px] lg:text-sm font-semibold text-muted-foreground pb-2\">\n                          Cost\n                        </th>\n                        <th className=\"text-right text-[10px] lg:text-sm font-semibold text-muted-foreground pb-2\">\n                          Total\n                        </th>\n                      </tr>\n                    </thead>\n                    <tbody>\n                      {invoice.items.map((item, index) => (\n                        <tr key={index} className=\"border-b border-border/50 hover:bg-muted/30 transition-colors\">\n                          <td className=\"py-2 sm:py-3 text-[10px] lg:text-sm text-muted-foreground font-medium\">\n                            {item.description}\n                          </td>\n                          <td className=\"py-2 sm:py-3 text-[10px] lg:text-sm text-center text-muted-foreground font-medium\">\n                            {item.qty}\n                          </td>\n                          <td className=\"py-2 sm:py-3 text-[10px] lg:text-sm text-right text-muted-foreground font-medium\">\n                            ${item.cost.toFixed(2)}\n                          </td>\n                          <td className=\"py-2 sm:py-3 text-[10px] lg:text-sm text-right text-muted-foreground font-medium\">\n                            ${item.total.toFixed(2)}\n                          </td>\n                        </tr>\n                      ))}\n                    </tbody>\n                  </table>\n                </div>\n              </div>\n\n              {/* Summary */}\n              <div className=\"flex justify-end mt-auto\">\n                <div className=\"w-48 lg:w-64\">\n                  <div className=\"flex justify-between py-2 border-b-2 border-border\">\n                    <span className=\"text-[10px] lg:text-sm text-muted-foreground\">Subtotal</span>\n                    <span className=\"text-[10px] lg:text-sm text-foreground font-medium\">\n                      ${subtotal.toFixed(2)}\n                    </span>\n                  </div>\n                  <div className=\"flex justify-between py-2 sm:py-3\">\n                    <span className=\"text-xs lg:text-base font-semibold text-foreground\">Total</span>\n                    <span className=\"text-xs lg:text-base font-semibold text-foreground\">\n                      ${subtotal.toFixed(2)}\n                    </span>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}",
      "type": "registry:component",
      "target": "components/watermelon/invoice-generator-dashboard/invoicePageView.tsx"
    }
  ],
  "type": "registry:block"
}
