{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "json-form-fixtures",
  "title": "JSON Form — fixtures",
  "author": "ilinxa",
  "description": "JSON Form plus the dummy-data fixtures used by the docs-site demo.",
  "registryDependencies": [
    "@ilinxa/json-form"
  ],
  "files": [
    {
      "path": "src/registry/components/forms/json-form/dummy-data.ts",
      "content": "import type { FormSchema } from \"./types\";\n\n// ─── 1. Registration form ────────────────────────────────────────────────────\n\nexport const registrationFormSchema: FormSchema = {\n  meta: {\n    id: \"registration\",\n    version: \"1\",\n    title: \"Create your account\",\n    description:\n      \"All fields are required. We'll send a verification email to the address below.\",\n  },\n  fields: [\n    {\n      name: \"firstName\",\n      type: \"text\",\n      label: \"First name\",\n      placeholder: \"Hessam\",\n      validators: { required: true, minLength: 2 },\n      width: \"half\",\n      autoComplete: \"given-name\",\n    },\n    {\n      name: \"lastName\",\n      type: \"text\",\n      label: \"Last name\",\n      placeholder: \"Hezaveh\",\n      validators: { required: true, minLength: 2 },\n      width: \"half\",\n      autoComplete: \"family-name\",\n    },\n    {\n      name: \"email\",\n      type: \"email\",\n      label: \"Email\",\n      placeholder: \"you@example.com\",\n      validators: { required: true },\n      autoComplete: \"email\",\n    },\n    {\n      name: \"password\",\n      type: \"password\",\n      label: \"Password\",\n      validators: {\n        required: true,\n        minLength: { value: 8, message: \"Use at least 8 characters\" },\n      },\n      description: \"8+ characters. Mix in a number or symbol for extra strength.\",\n      autoComplete: \"new-password\",\n    },\n    {\n      name: \"acceptTos\",\n      type: \"checkbox\",\n      label: \"I accept the Terms of Service and Privacy Policy.\",\n      validators: { required: \"You must accept the terms to continue\" },\n    },\n  ],\n};\n\n// ─── 2. Contact form ─────────────────────────────────────────────────────────\n\nexport const contactFormSchema: FormSchema = {\n  meta: {\n    title: \"Contact us\",\n    description: \"We respond within one business day.\",\n  },\n  fields: [\n    {\n      name: \"topic\",\n      type: \"select\",\n      label: \"Topic\",\n      placeholder: \"Pick a topic\",\n      validators: { required: true },\n      options: [\n        { value: \"support\", label: \"Technical support\" },\n        { value: \"sales\", label: \"Sales\" },\n        { value: \"billing\", label: \"Billing\" },\n        { value: \"other\", label: \"Other\" },\n      ],\n    },\n    {\n      name: \"email\",\n      type: \"email\",\n      label: \"Your email\",\n      placeholder: \"you@example.com\",\n      validators: { required: true },\n    },\n    {\n      name: \"message\",\n      type: \"textarea\",\n      label: \"Message\",\n      placeholder: \"How can we help?\",\n      rows: 5,\n      validators: { required: true, minLength: 20, maxLength: 2000 },\n    },\n    {\n      name: \"newsletter\",\n      type: \"switch\",\n      label: \"Also send me product updates (about one per month).\",\n    },\n  ],\n};\n\n// ─── 3. Conditional form (showcases visibleWhen / enabledWhen / requiredWhen) ─\n\nexport const conditionalFormSchema: FormSchema = {\n  meta: {\n    title: \"Tell us about your project\",\n    description:\n      \"Fields adapt to your answers — `Other` reveals a free-text reason, `Annually` requires billing details.\",\n  },\n  fields: [\n    {\n      name: \"_section_basics\",\n      type: \"section\",\n      label: \"Basics\",\n    },\n    {\n      name: \"projectName\",\n      type: \"text\",\n      label: \"Project name\",\n      validators: { required: true },\n    },\n    {\n      name: \"kind\",\n      type: \"radio-group\",\n      label: \"Project type\",\n      validators: { required: true },\n      options: [\n        { value: \"internal\", label: \"Internal tool\" },\n        { value: \"public\", label: \"Public product\" },\n        { value: \"other\", label: \"Other\" },\n      ],\n    },\n    {\n      name: \"otherKindReason\",\n      type: \"text\",\n      label: \"Tell us more\",\n      placeholder: \"Briefly describe the project\",\n      visibleWhen: { field: \"kind\", equals: \"other\" },\n      requiredWhen: { field: \"kind\", equals: \"other\" },\n    },\n    {\n      name: \"_section_billing\",\n      type: \"section\",\n      label: \"Billing\",\n    },\n    {\n      name: \"cadence\",\n      type: \"select\",\n      label: \"Billing cadence\",\n      defaultValue: \"monthly\",\n      options: [\n        { value: \"monthly\", label: \"Monthly\" },\n        { value: \"annually\", label: \"Annually (save 20%)\" },\n      ],\n    },\n    {\n      name: \"company\",\n      type: \"text\",\n      label: \"Company name\",\n      visibleWhen: { field: \"cadence\", equals: \"annually\" },\n      requiredWhen: { field: \"cadence\", equals: \"annually\" },\n    },\n    {\n      name: \"vatId\",\n      type: \"text\",\n      label: \"VAT ID\",\n      placeholder: \"Optional\",\n      enabledWhen: { field: \"cadence\", equals: \"annually\" },\n    },\n  ],\n};\n\n// ─── 4. Computed form + sections ─────────────────────────────────────────────\n\nexport const computedFormSchema: FormSchema = {\n  meta: {\n    title: \"User profile\",\n    description: \"`displayName` and `domain` update live as you type.\",\n  },\n  fields: [\n    {\n      name: \"_section_identity\",\n      type: \"section\",\n      label: \"Identity\",\n    },\n    {\n      name: \"firstName\",\n      type: \"text\",\n      label: \"First name\",\n      defaultValue: \"Hessam\",\n      width: \"half\",\n    },\n    {\n      name: \"lastName\",\n      type: \"text\",\n      label: \"Last name\",\n      defaultValue: \"Hezaveh\",\n      width: \"half\",\n    },\n    {\n      name: \"displayName\",\n      type: \"computed\",\n      label: \"Display name\",\n      expression: \"{firstName} {lastName}\",\n    },\n    {\n      name: \"_divider1\",\n      type: \"divider\",\n    },\n    {\n      name: \"_section_contact\",\n      type: \"section\",\n      label: \"Contact\",\n    },\n    {\n      name: \"email\",\n      type: \"email\",\n      label: \"Email\",\n      defaultValue: \"hessam@example.com\",\n    },\n    {\n      name: \"domain\",\n      type: \"computed\",\n      label: \"Email domain\",\n      compute: ({ values }) => {\n        const email = values.email;\n        if (typeof email !== \"string\") return \"\";\n        const at = email.indexOf(\"@\");\n        return at >= 0 ? email.slice(at + 1) : \"\";\n      },\n    },\n  ],\n};\n\n// ─── 5. Rich-fields form (code + slider + rating) ────────────────────────────\n\nexport const richFieldsFormSchema: FormSchema = {\n  meta: {\n    title: \"Submit a snippet\",\n    description:\n      \"Showcases the `code`, `richtext`, `slider`, and `rating` field types.\",\n  },\n  fields: [\n    {\n      name: \"title\",\n      type: \"text\",\n      label: \"Title\",\n      validators: { required: true, maxLength: 80 },\n    },\n    {\n      name: \"summary\",\n      type: \"richtext\",\n      label: \"Summary\",\n      placeholder: \"Write a short description with bold, lists, links…\",\n      defaultValue: [\n        {\n          type: \"p\",\n          children: [{ text: \"\" }],\n        },\n      ],\n    },\n    {\n      name: \"lang\",\n      type: \"select\",\n      label: \"Language\",\n      defaultValue: \"typescript\",\n      options: [\n        { value: \"typescript\", label: \"TypeScript\" },\n        { value: \"javascript\", label: \"JavaScript\" },\n        { value: \"python\", label: \"Python\" },\n        { value: \"json\", label: \"JSON\" },\n      ],\n    },\n    {\n      name: \"source\",\n      type: \"code\",\n      label: \"Source\",\n      lang: \"typescript\",\n      defaultValue: \"function greet(name: string) {\\n  return `Hello, ${name}!`;\\n}\\n\",\n      validators: { required: true },\n    },\n    {\n      name: \"complexity\",\n      type: \"slider\",\n      label: \"Complexity\",\n      min: 1,\n      max: 10,\n      step: 1,\n      defaultValue: 3,\n    },\n    {\n      name: \"rating\",\n      type: \"rating\",\n      label: \"Your rating\",\n      config: { rating: { stars: 5 } },\n      defaultValue: 4,\n    },\n  ],\n};\n\n// ─── 6. Admin user form (mixed kitchen-sink) ─────────────────────────────────\n\nexport const adminUserFormSchema: FormSchema = {\n  meta: {\n    title: \"Edit user\",\n    description: \"All field families in a single form.\",\n  },\n  fields: [\n    {\n      name: \"_section_account\",\n      type: \"section\",\n      label: \"Account\",\n    },\n    {\n      name: \"username\",\n      type: \"text\",\n      label: \"Username\",\n      validators: { required: true, pattern: \"^[a-z0-9_-]{3,32}$\" },\n      description: \"Lowercase letters, digits, underscores, and hyphens. 3–32 chars.\",\n      width: \"half\",\n    },\n    {\n      name: \"email\",\n      type: \"email\",\n      label: \"Email\",\n      validators: { required: true },\n      width: \"half\",\n    },\n    {\n      name: \"role\",\n      type: \"radio-group\",\n      label: \"Role\",\n      defaultValue: \"member\",\n      options: [\n        { value: \"owner\", label: \"Owner\" },\n        { value: \"admin\", label: \"Admin\" },\n        { value: \"member\", label: \"Member\" },\n      ],\n    },\n    {\n      name: \"permissions\",\n      type: \"checkbox-group\",\n      label: \"Permissions\",\n      options: [\n        { value: \"read\", label: \"Read\" },\n        { value: \"write\", label: \"Write\" },\n        { value: \"publish\", label: \"Publish\" },\n        { value: \"delete\", label: \"Delete\" },\n      ],\n      defaultValue: [\"read\"],\n    },\n    {\n      name: \"_section_profile\",\n      type: \"section\",\n      label: \"Profile\",\n    },\n    {\n      name: \"bio\",\n      type: \"textarea\",\n      label: \"Bio\",\n      rows: 3,\n      validators: { maxLength: 280 },\n    },\n    {\n      name: \"joinedOn\",\n      type: \"date\",\n      label: \"Joined on\",\n      defaultValue: \"2026-01-01\",\n      width: \"half\",\n    },\n    {\n      name: \"vacationRange\",\n      type: \"date-range\",\n      label: \"Next vacation\",\n      width: \"half\",\n    },\n    {\n      name: \"shiftStart\",\n      type: \"time\",\n      label: \"Shift start\",\n      defaultValue: \"09:00\",\n      width: \"half\",\n    },\n    {\n      name: \"appointmentAt\",\n      type: \"datetime\",\n      label: \"Next appointment\",\n      width: \"half\",\n    },\n    {\n      name: \"notifications\",\n      type: \"switch\",\n      label: \"Email notifications\",\n      defaultValue: true,\n    },\n    {\n      name: \"csrf\",\n      type: \"hidden\",\n      defaultValue: \"csrf-token-abc123\",\n    },\n  ],\n};\n\n// ─── Async resolver (for the backend-driven demo tab) ────────────────────────\n\n/**\n * Mock backend that \"fetches\" a schema by id. Resolves after 800ms.\n * Used by the demo's \"Backend-driven\" tab.\n */\nexport async function mockFetchSchema(formId: string): Promise<FormSchema> {\n  await new Promise((resolve) => setTimeout(resolve, 800));\n  switch (formId) {\n    case \"contact\":\n      return contactFormSchema;\n    case \"rich\":\n      return richFieldsFormSchema;\n    case \"admin\":\n      return adminUserFormSchema;\n    case \"registration\":\n    default:\n      return registrationFormSchema;\n  }\n}\n\n// @ilinxa/json-form-fixtures 0.2.9\n",
      "type": "registry:component",
      "target": "components/json-form/dummy-data.ts"
    }
  ],
  "meta": {
    "version": "0.2.9",
    "status": "alpha"
  },
  "categories": [
    "forms",
    "fixtures"
  ],
  "type": "registry:block"
}