{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "contact-section",
  "title": "Contact Section",
  "description": "Contact options, availability, a message form with its states, and expectations.",
  "dependencies": [
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "https://uaiblocks.dev/r/uai-theme.json",
    "https://uaiblocks.dev/r/status-banner.json",
    "https://uaiblocks.dev/r/form-field.json",
    "https://uaiblocks.dev/r/uai-utils.json"
  ],
  "files": [
    {
      "path": "src/registry/uai/blocks/contact-section.tsx",
      "content": "\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport { Check } from \"lucide-react\";\nimport {\n  type ComponentProps,\n  createContext,\n  type FormEvent,\n  useContext,\n  useId,\n  useState,\n} from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  StatusBanner,\n  StatusBannerContent,\n  StatusBannerIcon,\n  type StatusBannerProps,\n} from \"@/components/ui/uai/status-banner\";\nimport { cn } from \"@/lib/uai-utils\";\n\nexport const CONTACT_SECTION_VARIANTS = [\"split\", \"stacked\", \"card\"] as const;\nexport type ContactSectionVariant = (typeof CONTACT_SECTION_VARIANTS)[number];\nexport type ContactSectionProps = ComponentProps<\"section\"> & { variant?: ContactSectionVariant };\nexport type ContactSectionStatus = \"idle\" | \"submitting\" | \"success\" | \"error\";\n\ntype SectionContext = {\n  id: string;\n  variant: ContactSectionVariant;\n  status: ContactSectionStatus;\n  setStatus: (status: ContactSectionStatus) => void;\n};\nconst Context = createContext<SectionContext | null>(null);\nfunction useSection(part: string) {\n  const context = useContext(Context);\n  if (!context) throw new Error(`${part} must be used within ContactSection`);\n  return context;\n}\n\nconst contactSectionVariants = cva(\"@container min-w-0 text-[13px]/[18px] text-foreground\", {\n  variants: {\n    variant: {\n      split: \"py-2\",\n      stacked: \"mx-auto max-w-[640px] py-2\",\n      card: \"rounded-[14px] border bg-card p-[clamp(16px,4cqi,28px)] shadow-[0_1px_2px_oklch(0_0_0/0.04)]\",\n    },\n  },\n});\n\nconst actionClass =\n  \"justify-self-start rounded-full border-0 py-0 transition-[filter,box-shadow,background-color,scale] duration-[120ms,120ms,120ms,140ms] ease-[ease-out,ease-out,ease-out,cubic-bezier(0.23,1,0.32,1)] focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-ring active:not-aria-disabled:scale-[0.97] motion-reduce:transition-none motion-reduce:active:not-aria-disabled:scale-100\";\n\n/** Contact options, availability, a message form with its states, and response expectations. */\nexport function ContactSection({\n  variant = \"split\",\n  className,\n  children,\n  ...props\n}: ContactSectionProps) {\n  const id = useId();\n  const [status, setStatus] = useState<ContactSectionStatus>(\"idle\");\n  return (\n    <Context.Provider value={{ id, variant, status, setStatus }}>\n      <section\n        aria-labelledby={`${id}-title`}\n        data-slot=\"contact-section\"\n        data-variant={variant}\n        className={cn(contactSectionVariants({ variant }), className)}\n        {...props}\n      >\n        <div\n          className={cn(\n            \"grid min-w-0 items-start gap-6\",\n            variant !== \"stacked\" &&\n              \"@min-[720px]:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] @min-[720px]:gap-x-10\",\n          )}\n        >\n          {children}\n        </div>\n      </section>\n    </Context.Provider>\n  );\n}\n\nexport function ContactSectionDetails({ className, ...props }: ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"contact-section-details\"\n      className={cn(\"grid min-w-0 gap-5\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionHeader({ className, ...props }: ComponentProps<\"header\">) {\n  return (\n    <header data-slot=\"contact-section-header\" className={cn(\"grid gap-2\", className)} {...props} />\n  );\n}\n\nexport function ContactSectionTitle({ className, ...props }: ComponentProps<\"h2\">) {\n  const { id } = useSection(\"ContactSectionTitle\");\n  return (\n    <h2\n      data-slot=\"contact-section-title\"\n      className={cn(\n        \"m-0 text-[length:clamp(22px,2.5cqi_+_12px,30px)] leading-[1.15] font-medium tracking-[-0.025em] text-balance\",\n        className,\n      )}\n      {...props}\n      id={`${id}-title`}\n    />\n  );\n}\n\nexport function ContactSectionDescription({ className, ...props }: ComponentProps<\"p\">) {\n  return (\n    <p\n      data-slot=\"contact-section-description\"\n      className={cn(\"m-0 text-[15px]/[23px] text-pretty text-muted-foreground\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionOptions({ className, ...props }: ComponentProps<\"ul\">) {\n  const { variant } = useSection(\"ContactSectionOptions\");\n  return (\n    <ul\n      data-slot=\"contact-section-options\"\n      className={cn(\n        \"m-0 grid list-none gap-2 p-0\",\n        variant === \"stacked\"\n          ? \"grid-cols-[repeat(auto-fit,minmax(min(100%,170px),1fr))]\"\n          : \"grid-cols-1\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionOption({ className, ...props }: ComponentProps<\"li\">) {\n  const { variant } = useSection(\"ContactSectionOption\");\n  return (\n    <li\n      data-slot=\"contact-section-option\"\n      className={cn(\n        \"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-start gap-x-3 gap-y-0.5 rounded-xl p-3\",\n        variant === \"card\"\n          ? \"bg-[color-mix(in_oklab,var(--muted)_70%,var(--card))] shadow-none\"\n          : \"bg-card shadow-[inset_0_0_0_1px_var(--border)]\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionOptionIcon({ className, ...props }: ComponentProps<\"span\">) {\n  return (\n    <span\n      aria-hidden=\"true\"\n      data-slot=\"contact-section-option-icon\"\n      className={cn(\n        \"row-[1/span_3] grid size-7 place-items-center rounded-lg bg-muted text-muted-foreground\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionOptionTitle({ className, ...props }: ComponentProps<\"h3\">) {\n  return (\n    <h3\n      data-slot=\"contact-section-option-title\"\n      className={cn(\"col-start-2 m-0 text-[13px]/[18px] font-medium\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionOptionDetail({ className, ...props }: ComponentProps<\"p\">) {\n  return (\n    <p\n      data-slot=\"contact-section-option-detail\"\n      className={cn(\"col-start-2 m-0 text-[12px]/[17px] text-subtle-foreground\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionOptionLink({ className, ...props }: ComponentProps<\"a\">) {\n  return (\n    <a\n      data-slot=\"contact-section-option-link\"\n      className={cn(\n        \"col-start-2 mt-0.5 justify-self-start text-[12.5px] font-medium text-foreground underline decoration-border-strong underline-offset-3 wrap-anywhere transition-[text-decoration-color] duration-120 ease-[ease-out] hover:decoration-current focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport type ContactSectionAvailabilityProps = ComponentProps<\"p\"> & {\n  /** Whether the team is available now. The text must say so too; the dot is decorative. */\n  available?: boolean;\n};\n\nexport function ContactSectionAvailability({\n  available = false,\n  children,\n  className,\n  ...props\n}: ContactSectionAvailabilityProps) {\n  return (\n    <p\n      data-slot=\"contact-section-availability\"\n      data-available={available}\n      className={cn(\"m-0 flex items-center gap-2 text-[12px] text-muted-foreground\", className)}\n      {...props}\n    >\n      <span\n        aria-hidden=\"true\"\n        className={cn(\n          \"size-[7px] flex-none rounded-full\",\n          available\n            ? \"bg-success text-success-ink animate-[ring-pulse_2s_cubic-bezier(0.23,1,0.32,1)_infinite] motion-reduce:animate-none\"\n            : \"bg-border-strong\",\n        )}\n      />\n      <span>{children}</span>\n    </p>\n  );\n}\n\nexport function ContactSectionExpectations({ className, ...props }: ComponentProps<\"ul\">) {\n  return (\n    <ul\n      data-slot=\"contact-section-expectations\"\n      className={cn(\n        \"m-0 grid list-none gap-[7px] p-0 text-[12.5px]/[18px] text-muted-foreground\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionExpectation({ children, className, ...props }: ComponentProps<\"li\">) {\n  return (\n    <li\n      data-slot=\"contact-section-expectation\"\n      className={cn(\"flex items-start gap-2\", className)}\n      {...props}\n    >\n      <Check\n        size={14}\n        strokeWidth={2}\n        aria-hidden=\"true\"\n        className=\"mt-0.5 flex-none text-subtle-foreground size-3.5\"\n      />\n      <span>{children}</span>\n    </li>\n  );\n}\n\nexport type ContactSectionResult = \"success\" | \"error\";\nexport type ContactSectionFormProps = Omit<ComponentProps<\"form\">, \"onSubmit\"> & {\n  /** Receives the form data. Resolve \"error\" or throw to show the error state. */\n  onSend: (\n    data: FormData,\n    // biome-ignore lint/suspicious/noConfusingVoidType: async handlers without a result mean success.\n  ) => Promise<ContactSectionResult | void> | ContactSectionResult | void;\n};\n\nexport function ContactSectionForm({ onSend, className, ...props }: ContactSectionFormProps) {\n  const section = useSection(\"ContactSectionForm\");\n  const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    if (section.status === \"submitting\") return;\n    const form = event.currentTarget;\n    if (!form.checkValidity()) {\n      form.reportValidity();\n      return;\n    }\n    section.setStatus(\"submitting\");\n    try {\n      const result = await onSend(new FormData(form));\n      section.setStatus(result === \"error\" ? \"error\" : \"success\");\n    } catch {\n      section.setStatus(\"error\");\n    }\n  };\n  return (\n    <form\n      noValidate\n      aria-busy={section.status === \"submitting\"}\n      data-slot=\"contact-section-form\"\n      className={cn(\n        \"grid min-w-0 gap-3\",\n        section.variant === \"card\"\n          ? \"rounded-xl bg-[color-mix(in_oklab,var(--muted)_70%,var(--card))] p-4\"\n          : \"rounded-none bg-transparent p-0\",\n        className,\n      )}\n      {...props}\n      onSubmit={handleSubmit}\n    />\n  );\n}\n\n/** Form fields and the submit control. Hidden after a successful send. */\nexport function ContactSectionFields({ className, ...props }: ComponentProps<\"div\">) {\n  const section = useSection(\"ContactSectionFields\");\n  if (section.status === \"success\") return null;\n  return (\n    <div\n      data-slot=\"contact-section-fields\"\n      className={cn(\"grid min-w-0 gap-3\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContactSectionSubmit({\n  children = \"Send message\",\n  pendingLabel = \"Sending…\",\n  onClick,\n  className,\n  ...props\n}: Omit<ComponentProps<\"button\">, \"type\"> & { pendingLabel?: string }) {\n  const section = useSection(\"ContactSectionSubmit\");\n  const pending = section.status === \"submitting\";\n  return (\n    <Button\n      data-slot=\"contact-section-submit\"\n      className={cn(\n        actionClass,\n        \"h-8.5 px-4 text-[13px] whitespace-nowrap has-[>svg]:px-4\",\n        pending\n          ? \"cursor-progress bg-muted text-muted-foreground hover:bg-muted\"\n          : \"cursor-pointer bg-primary text-primary-foreground hover:bg-primary hover:not-aria-disabled:brightness-[1.08]\",\n        className,\n      )}\n      {...props}\n      type=\"submit\"\n      aria-disabled={pending || undefined}\n      onClick={(event) => {\n        if (pending) event.preventDefault();\n        onClick?.(event);\n      }}\n    >\n      {/* Both labels share one grid cell so the button keeps its width while sending. */}\n      <span className=\"grid *:[grid-area:1/1]\">\n        <span\n          aria-hidden={pending || undefined}\n          className={cn(\"inline-flex items-center justify-center gap-1.5\", pending && \"invisible\")}\n        >\n          {children}\n        </span>\n        <span\n          aria-hidden={!pending || undefined}\n          className={cn(\n            \"shimmer-text text-center motion-reduce:text-muted-foreground\",\n            !pending && \"invisible\",\n          )}\n        >\n          {pendingLabel}\n        </span>\n      </span>\n    </Button>\n  );\n}\n\ntype ContactSectionResultProps = Omit<StatusBannerProps, \"tone\" | \"open\" | \"defaultOpen\">;\n\nfunction ResultBanner({\n  tone,\n  children,\n  ...props\n}: ContactSectionResultProps & { tone: \"success\" | \"error\" }) {\n  return (\n    <StatusBanner data-slot={`contact-section-${tone}`} variant=\"tinted\" {...props} tone={tone}>\n      <StatusBannerIcon />\n      <StatusBannerContent>{children}</StatusBannerContent>\n    </StatusBanner>\n  );\n}\n\n/** A success Status Banner shown after the message is sent. Compose StatusBannerTitle and description inside. */\nexport function ContactSectionSuccess(props: ContactSectionResultProps) {\n  const section = useSection(\"ContactSectionSuccess\");\n  if (section.status !== \"success\") return null;\n  return <ResultBanner {...props} tone=\"success\" />;\n}\n\n/** An error Status Banner shown when sending fails. The fields stay filled so people can retry. */\nexport function ContactSectionError(props: ContactSectionResultProps) {\n  const section = useSection(\"ContactSectionError\");\n  if (section.status !== \"error\") return null;\n  return <ResultBanner {...props} tone=\"error\" />;\n}\n\nexport function ContactSectionReset({ onClick, className, ...props }: ComponentProps<\"button\">) {\n  const section = useSection(\"ContactSectionReset\");\n  if (section.status !== \"success\") return null;\n  return (\n    <Button\n      type=\"button\"\n      variant=\"secondary\"\n      data-slot=\"contact-section-reset\"\n      className={cn(\n        actionClass,\n        \"h-7.5 cursor-pointer bg-secondary px-[13px] text-[12.5px] text-secondary-foreground hover:bg-secondary hover:shadow-[inset_0_0_0_999px_color-mix(in_oklab,var(--foreground)_9%,transparent)] has-[>svg]:px-[13px]\",\n        className,\n      )}\n      {...props}\n      onClick={(event) => {\n        onClick?.(event);\n        if (!event.defaultPrevented) section.setStatus(\"idle\");\n      }}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/uai/contact-section.tsx"
    }
  ],
  "categories": [
    "marketing",
    "forms",
    "support"
  ],
  "type": "registry:block"
}