{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "field",
  "type": "registry:ui",
  "title": "Field",
  "dependencies": [
    "@base-ui-next/react",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json",
    "https://hamur.dev/r/react/label.json",
    "https://hamur.dev/r/react/separator.json"
  ],
  "files": [
    {
      "path": "react/field.tsx",
      "content": "'use client'\n\nimport type * as React from 'react' // base-ui-next/ui field@0.1.2\nimport { Field as FieldPrimitive, unstable_useHasFieldRoot } from '@base-ui-next/react/field'\nimport { Fieldset as FieldsetPrimitive } from '@base-ui-next/react/fieldset'\nimport { useRender } from '@base-ui-next/react/use-render'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { Label } from '@/components/ui/label'\nimport { Separator } from '@/components/ui/separator'\n\nconst fieldSetClassName =\n  'flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3'\n\nconst fieldLegendClassName =\n  'mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base'\n\nconst fieldGroupClassName =\n  'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4'\n\nconst fieldVariants = cva('group/field flex w-full gap-3 data-invalid:text-destructive', {\n  variants: {\n    orientation: {\n      vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n      horizontal:\n        'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n      responsive:\n        'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n    },\n  },\n  defaultVariants: {\n    orientation: 'vertical',\n  },\n})\n\nconst fieldContentClassName = 'group/field-content flex flex-1 flex-col gap-1 leading-snug'\n\nconst fieldLabelClassName =\n  'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-disabled/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col'\n\nconst fieldTitleClassName =\n  'flex w-fit items-center gap-2 text-sm font-medium group-data-disabled/field:opacity-50'\n\nconst fieldDescriptionClassName =\n  'text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5 last:mt-0 nth-last-2:-mt-1 [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary'\n\nconst fieldSeparatorClassName =\n  'relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2'\n\n/** The line of the separator, a `Separator`. */\nconst fieldSeparatorLineClassName = 'absolute inset-0 top-1/2'\n\nconst fieldSeparatorContentClassName =\n  'relative mx-auto block w-fit bg-background px-2 text-muted-foreground'\n\nconst fieldErrorClassName = 'text-sm font-normal text-destructive'\n\n// base-vega's field is plain elements; here the parts are Base UI's Field and Fieldset, so the\n// label, description and error are wired to the control and `data-invalid`/`data-disabled` come\n// from the field's state (10 · As built, BN-320).\n\nfunction FieldSet({ className, ...props }: FieldsetPrimitive.Root.Props) {\n  return (\n    <FieldsetPrimitive.Root\n      data-slot=\"field-set\"\n      className={cn(fieldSetClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction FieldLegend({\n  className,\n  variant = 'legend',\n  ...props\n}: FieldsetPrimitive.Legend.Props & { variant?: 'legend' | 'label' }) {\n  return (\n    <FieldsetPrimitive.Legend\n      data-slot=\"field-legend\"\n      data-variant={variant}\n      className={cn(fieldLegendClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n  return <div data-slot=\"field-group\" className={cn(fieldGroupClassName, className)} {...props} />\n}\n\nfunction Field({\n  className,\n  orientation = 'vertical',\n  ...props\n}: FieldPrimitive.Root.Props & VariantProps<typeof fieldVariants>) {\n  return (\n    <FieldPrimitive.Root\n      role=\"group\"\n      data-slot=\"field\"\n      data-orientation={orientation}\n      className={cn(fieldVariants({ orientation }), className)}\n      {...props}\n    />\n  )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n  return (\n    <div data-slot=\"field-content\" className={cn(fieldContentClassName, className)} {...props} />\n  )\n}\n\n// The Label item renders the Base UI field label, so its classes stay in `label`.\nfunction FieldLabel({ className, ...props }: FieldPrimitive.Label.Props) {\n  return (\n    <FieldPrimitive.Label\n      render={<Label />}\n      data-slot=\"field-label\"\n      className={cn(fieldLabelClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n  return <div data-slot=\"field-label\" className={cn(fieldTitleClassName, className)} {...props} />\n}\n\n// Base UI's description needs a Field; shadcn's is a `<p>` that may sit in a FieldSet with none, so\n// outside a Field it is that `<p>`, rendered by `useRender` so a `render` prop still applies; a\n// render function gets the state of a field nobody has touched.\nconst plainDescriptionState: FieldPrimitive.Description.State & Record<string, unknown> = {\n  disabled: false,\n  touched: false,\n  dirty: false,\n  valid: null,\n  filled: false,\n  focused: false,\n}\n\nfunction PlainDescription({ render, ...props }: FieldPrimitive.Description.Props) {\n  return useRender<typeof plainDescriptionState, HTMLParagraphElement>({\n    defaultTagName: 'p',\n    props,\n    render,\n    state: plainDescriptionState,\n  })\n}\n\nfunction FieldDescription({ className, ...props }: FieldPrimitive.Description.Props) {\n  const Description = unstable_useHasFieldRoot() ? FieldPrimitive.Description : PlainDescription\n  return (\n    <Description\n      data-slot=\"field-description\"\n      className={cn(fieldDescriptionClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction FieldSeparator({\n  children,\n  className,\n  ...props\n}: React.ComponentProps<'div'> & {\n  children?: React.ReactNode\n}) {\n  return (\n    <div\n      data-slot=\"field-separator\"\n      data-content={!!children}\n      className={cn(fieldSeparatorClassName, className)}\n      {...props}\n    >\n      <Separator className={fieldSeparatorLineClassName} />\n      {children && (\n        <span className={fieldSeparatorContentClassName} data-slot=\"field-separator-content\">\n          {children}\n        </span>\n      )}\n    </div>\n  )\n}\n\n// Base UI's field error: shown while the field is invalid (or as its `match` prop says). shadcn's\n// `errors` prop, a form library's error list, belongs to Form (BN-324).\nfunction FieldError({ className, ...props }: FieldPrimitive.Error.Props) {\n  return (\n    <FieldPrimitive.Error\n      role=\"alert\"\n      data-slot=\"field-error\"\n      className={cn(fieldErrorClassName, className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Field,\n  FieldLabel,\n  FieldDescription,\n  FieldError,\n  FieldGroup,\n  FieldLegend,\n  FieldSeparator,\n  FieldSet,\n  FieldContent,\n  FieldTitle,\n}\n",
      "type": "registry:ui",
      "target": "@ui/field.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.2",
      "hash": "ce14a8d2f90fd0c4fc9e0cb58a96877d1163b8d711167b559142e58fc3f6ab0c",
      "files": {
        "@ui/field.tsx": "63fee0e84c27d813b3ea7ef775554c388aea8d7ae54f500ebedd3570b577731c"
      }
    }
  }
}
