{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"form","title":"Form","description":"Base UI form root for validation, submission, reset, and server errors.","dependencies":["@base-ui/react@1.7.0"],"registryDependencies":["@siteplane/base"],"files":[{"path":"packages/ui/src/components/form/form.tsx","content":"\"use client\";\n\nimport { Form as FormPrimitive } from \"@base-ui/react/form\";\nimport * as React from \"react\";\n\nimport type { WithStringClassName } from \"../../system/utils/cn\";\nimport { slotClass } from \"../../system/utils/slot-class\";\nimport { cn } from \"../../system/utils/cn\";\n\ntype FormErrors = FormPrimitive.Props[\"errors\"];\n\n/**\n * A native form element with Base UI's consolidated error handling. A native\n * reset, from a reset button or `form.reset()`, clears the `errors` the form\n * was given until new errors arrive, and each Field returns to how it was\n * before the first submit, so no error stays on a value the reset restored.\n */\nexport function Form({\n  className,\n  errors,\n  onReset,\n  ...props\n}: WithStringClassName<FormPrimitive.Props>): React.ReactElement {\n  // The errors a reset cleared. A new errors object shows again.\n  const [clearedErrors, setClearedErrors] = React.useState<FormErrors>();\n\n  return (\n    <FormPrimitive\n      className={cn(slotClass(\"form\", props), className)}\n      data-slot=\"form\"\n      errors={\n        errors !== undefined && errors === clearedErrors ? undefined : errors\n      }\n      onReset={(event) => {\n        onReset?.(event);\n        // Like the controls' own reset, wait until every handler could still\n        // cancel it.\n        queueMicrotask(() => {\n          if (!event.defaultPrevented) setClearedErrors(errors);\n        });\n      }}\n      {...props}\n    />\n  );\n}\n\nexport { FormPrimitive };\n","type":"registry:ui","target":"~/src/siteplane/components/form/form.tsx"},{"path":"packages/ui/src/components/form/index.ts","content":"export * from \"./form\";\n","type":"registry:ui","target":"~/src/siteplane/components/form/index.ts"}],"type":"registry:ui","docs":"https://ui.siteplane.io/docs-markdown/components/form.md","categories":["Forms & selection"],"meta":{"avoidWhen":["Avoid for a single control whose change applies at once, such as a Switch in a settings row."],"description":"Base UI form root for validation, submission, reset, and server errors.","knownLimitations":["Kit Buttons default to type=\"button\"; give the submit button type=\"submit\".","An async Field validate does not stop onSubmit from running; await a server check in the submission handler."],"providerNotes":[],"releaseStatus":"stable","searchTerms":["form"],"useWhen":["Use to submit related fields together, with validation, a reset and errors returned by the server."]}}