{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "support-ticket-form",
  "title": "Support Ticket Form",
  "description": "Support ticket form with select and multi-select fields.",
  "registryDependencies": [
    "@buzzform/select",
    "card",
    "sonner"
  ],
  "files": [
    {
      "path": "registry/shadcn/examples/support-ticket-form.tsx",
      "content": "\"use client\";\n\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\";\nimport {\n  Form,\n  FormContent,\n  FormFields,\n  FormSubmit,\n} from \"@/registry/shadcn/form\";\nimport { toast } from \"sonner\";\nimport { defineSchema, type InferType } from \"@buildnbuzz/form-react\";\n\nconst categoryOptions = [\n  {\n    value: \"technical\",\n    label: \"Technical Issue\",\n    description: \"Software bugs, errors, or crashes\",\n  },\n  {\n    value: \"billing\",\n    label: \"Billing & Payments\",\n    description: \"Invoices, refunds, or payment methods\",\n  },\n  {\n    value: \"account\",\n    label: \"Account\",\n    description: \"Password, profile, or security settings\",\n  },\n  {\n    value: \"feature\",\n    label: \"Feature Request\",\n    description: \"Suggest new features or improvements\",\n  },\n];\n\nconst priorityOptions = [\n  { value: \"low\", label: \"Low\", description: \"No impact on work\" },\n  { value: \"medium\", label: \"Medium\", description: \"Some features affected\" },\n  { value: \"high\", label: \"High\", description: \"Major functionality impacted\" },\n  { value: \"urgent\", label: \"Urgent\", description: \"Complete blocker\" },\n];\nconst subcategories: Record<string, Array<{ value: string; label: string }>> = {\n  technical: [\n    { value: \"bug\", label: \"Software Bug\" },\n    { value: \"crash\", label: \"System Crash\" },\n    { value: \"performance\", label: \"Performance Issue\" },\n  ],\n  billing: [\n    { value: \"refund\", label: \"Refund Request\" },\n    { value: \"subscription\", label: \"Subscription Issue\" },\n    { value: \"invoice\", label: \"Invoice Query\" },\n  ],\n  account: [\n    { value: \"password\", label: \"Password Reset\" },\n    { value: \"security\", label: \"Security Breach\" },\n    { value: \"profile\", label: \"Profile Update\" },\n  ],\n  feature: [\n    { value: \"ui\", label: \"UI Improvement\" },\n    { value: \"new-feature\", label: \"New Functionality\" },\n    { value: \"api\", label: \"API Integration\" },\n  ],\n};\n\nconst teamMembers = [\n  { value: \"alice\", label: \"Alice Johnson\" },\n  { value: \"bob\", label: \"Bob Smith\" },\n  { value: \"carol\", label: \"Carol Williams\" },\n  { value: \"david\", label: \"David Brown\" },\n  { value: \"emma\", label: \"Emma Davis\" },\n];\n\n// Support ticket form showcasing dynamic options\nconst ticketSchema = defineSchema({\n  fields: [\n    {\n      type: \"select\",\n      name: \"category\",\n      label: \"Category\",\n      required: true,\n      options: categoryOptions,\n      placeholder: \"Choose a category...\",\n    },\n    {\n      type: \"select\",\n      name: \"subcategory\",\n      label: \"Subcategory\",\n      required: true,\n      options: async ({ data }) => {\n        const cat = data.category as string;\n        // Simulate network latency\n        await new Promise((resolve) => setTimeout(resolve, 600));\n        return subcategories[cat] || [];\n      },\n      dependencies: [\"/category\"],\n      description: \"Available subcategories based on your chosen category\",\n      disabled: { $data: \"/category\", not: true },\n      ui: {\n        emptyMessage: \"Select a category first\",\n      },\n    },\n    {\n      type: \"select\",\n      name: \"priority\",\n      label: \"Priority\",\n      required: true,\n      options: priorityOptions,\n      placeholder: \"Set priority...\",\n    },\n    {\n      type: \"select\",\n      name: \"assignees\",\n      label: \"Assign To\",\n      hasMany: true,\n      options: teamMembers,\n      placeholder: \"Select team members...\",\n      description: \"Optionally assign to team members\",\n      ui: {\n        isClearable: true,\n        maxVisibleChips: 2,\n      },\n    },\n  ],\n});\n\ntype TicketSchema = InferType<typeof ticketSchema.fields>;\n\nexport default function SupportTicketForm() {\n  return (\n    <Card className=\"w-full max-w-md mx-auto\">\n      <CardHeader>\n        <CardTitle>Submit Support Ticket</CardTitle>\n        <CardDescription>\n          Dynamic dropdowns with dependent options and multi-select\n        </CardDescription>\n      </CardHeader>\n      <CardContent>\n        <Form\n          schema={ticketSchema}\n          onSubmit={async ({ value }) => {\n            const data = value as TicketSchema;\n            await new Promise((resolve) => setTimeout(resolve, 1000));\n            toast(\"Ticket Submitted!\", {\n              description: (\n                <pre className=\"mt-2 max-h-48 overflow-auto rounded-md bg-muted text-muted-foreground p-3 text-xs\">\n                  <code>{JSON.stringify(data, null, 2)}</code>\n                </pre>\n              ),\n            });\n          }}\n        >\n          <FormContent>\n            <FormFields />\n            <div className=\"flex justify-end pt-4\">\n              <FormSubmit>Submit Ticket</FormSubmit>\n            </div>\n          </FormContent>\n        </Form>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/buzzform/examples/support-ticket-form.tsx"
    }
  ],
  "type": "registry:block"
}