{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "field",
  "type": "registry:ui",
  "title": "Field",
  "description": "Coordinate a control, label, help, errors and field state.",
  "dependencies": [
    "@base-ui/react@1.8.0"
  ],
  "registryDependencies": [
    "https://ghost-ui.com/r/ghost-tokens.json",
    "https://ghost-ui.com/r/foundation.json",
    "https://ghost-ui.com/r/base-styled.json",
    "https://ghost-ui.com/r/label.json",
    "https://ghost-ui.com/r/input.json"
  ],
  "files": [
    {
      "path": "src/components/ui/field.tsx",
      "type": "registry:component",
      "target": "@ui/field.tsx",
      "content": "\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { forwardRef, useContext, type ComponentProps } from \"react\";\n\nimport { styled } from \"./base-styled\";\nimport { Input } from \"./input\";\nimport { InputAppearanceContext, type InputSurfaceVariant } from \"./internal/input-appearance\";\nimport \"./label.css\";\nimport { labelPresentationAttributes, labelPresentationClassName } from \"./internal/label-presentation\";\n\nexport type FieldPlacement = \"top\" | \"ifta\" | \"left\" | \"placeholder\";\nexport type FieldRootProps = ComponentProps<typeof BaseField.Root> & {\n  /** Coordinate the input surface and label without changing validation. */\n  variant?: InputSurfaceVariant;\n  /** Visual label placement. The label stays in the accessibility tree. */\n  placement?: FieldPlacement;\n  /** Fill the available width when the field contains a full-width control. */\n  fullWidth?: boolean;\n};\n\nconst Root = forwardRef<HTMLDivElement, FieldRootProps>(function FieldRoot(\n  { placement = \"top\", fullWidth = false, variant, className, style, ...props }, ref,\n) {\n  const merged = typeof className === \"function\"\n    ? (state: BaseField.Root.State) => [\"ui-field\", className(state)].filter(Boolean).join(\" \")\n    : [\"ui-field\", className].filter(Boolean).join(\" \");\n  const rootStyle = !fullWidth ? style : typeof style === \"function\"\n    ? (state: BaseField.Root.State) => ({ width: \"100%\", ...style(state) })\n    : { width: \"100%\", ...style };\n  return <InputAppearanceContext.Provider value={{ variant, disabled: props.disabled, invalid: props.invalid }}>\n    <BaseField.Root {...props} ref={ref} className={merged} style={rootStyle} data-variant={variant} data-placement={placement} data-full-width={fullWidth || undefined} />\n  </InputAppearanceContext.Provider>;\n});\n\nexport type FieldLabelProps = ComponentProps<typeof BaseField.Label> & {\n  variant?: InputSurfaceVariant;\n  /** Show a visual required marker. Native validation belongs to the control. */\n  required?: boolean;\n  /** Show a visual optional marker when required is false. */\n  optional?: boolean;\n};\n\nconst FieldLabel = forwardRef<HTMLElement, FieldLabelProps>(function FieldLabel(\n  { className, variant, required = false, optional = false, ...props }, ref,\n) {\n  const appearance = useContext(InputAppearanceContext);\n  return <BaseField.Label\n    {...props}\n    ref={ref}\n    {...labelPresentationAttributes({ required, optional })}\n    data-variant={variant ?? appearance.variant}\n    className={labelPresentationClassName(className, \"ui-label\")}\n  />;\n});\n\nexport const Field = {\n  ...BaseField,\n  Root,\n  Label: FieldLabel,\n  Control: Input,\n  Description: /* @__PURE__ */ styled(BaseField.Description, \"ui-hint\"),\n  Error: /* @__PURE__ */ styled(BaseField.Error, \"ui-error\"),\n};\n"
    }
  ]
}
