{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "saas108",
  "title": "Branching Scoping Form",
  "description": "A contact section that asks a branching set of questions instead of one long form: a rail lists the steps that currently apply and lets you jump between them, and answering the first question adds or removes the steps below it.",
  "dependencies": [
    "clsx",
    "tailwind-merge",
    "lucide-react"
  ],
  "registryDependencies": [
    "questionnaire",
    "button"
  ],
  "files": [
    {
      "path": "registry/saas108/saas108.tsx",
      "content": "\"use client\";\n\nimport { Check, CheckCircle2, Clock, Lock, type LucideIcon, MessageSquare } from \"lucide-react\";\nimport Link from \"next/link\";\nimport { type ChangeEvent, type FormEvent, useState } from \"react\";\nimport { Badge6 } from \"@/components/beste/component/badge6\";\nimport { Button1 } from \"@/components/beste/component/button1\";\nimport {\n  Questionnaire,\n  QuestionnaireActions,\n  QuestionnaireChoice,\n  QuestionnaireChoiceDescription,\n  QuestionnaireChoices,\n  QuestionnaireDescription,\n  QuestionnaireError,\n  QuestionnaireInput,\n  QuestionnaireItem,\n  QuestionnaireNext,\n  QuestionnairePrevious,\n  QuestionnaireSkip,\n  QuestionnaireSubmit,\n  QuestionnaireTitle,\n} from \"@/components/ui/questionnaire\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Badge {\n  label: string;\n}\n\ninterface ActionButton {\n  label: string;\n  href: string;\n}\n\ninterface Assurance {\n  title: string;\n  description: string;\n  icon?: LucideIcon;\n}\n\ninterface Confirmation {\n  title?: string;\n  description?: string;\n}\n\ninterface OutlineChoice {\n  value: string;\n  label: string;\n  description?: string;\n}\n\n/**\n * A step is only asked when the named step's answer is one of `equals`. The\n * named step has to come earlier in the array, so a step can never gate itself\n * out from under the person standing on it.\n */\ninterface OutlineCondition {\n  step: string;\n  equals: string[];\n}\n\ninterface OutlineStep {\n  /** Form field name. Must be unique across the flow. */\n  name: string;\n  title: string;\n  description?: string;\n  /** Short label for the rail. Falls back to `title`. */\n  shortTitle?: string;\n  choices?: OutlineChoice[];\n  /** Free-text escape hatch rendered under the fixed choices */\n  input?: { label: string; placeholder?: string };\n  /** Blocks Next and hides Skip until the step is answered */\n  required?: boolean;\n  /** Renders the choices as checkboxes instead of radios */\n  multiple?: boolean;\n  /** Branching: drops the step out of the rail, the count, and navigation */\n  when?: OutlineCondition;\n}\n\ninterface OutlineLabels {\n  previous?: string;\n  skip?: string;\n  next?: string;\n  submit?: string;\n  /** The rail's own heading. Falls back to a \"Step n of m\" line. */\n  rail?: string;\n  answered?: string;\n  skipped?: string;\n}\n\ninterface Saas108Props {\n  badge?: Badge;\n  /** Short line beside the eyebrow, across the hairline divider */\n  meta?: string;\n  heading?: string;\n  description?: string;\n  outlineHeading?: string;\n  outlineDescription?: string;\n  steps?: OutlineStep[];\n  /** Prints a scoped shortcut on every choice and binds it while the step is active */\n  shortcuts?: \"letters\" | \"numbers\";\n  labels?: OutlineLabels;\n  /** The banner shown above the step once the flow is submitted */\n  confirmation?: Confirmation;\n  /** Seal CTA under the confirmation banner, for people who would rather talk */\n  button?: ActionButton;\n  assurances?: Assurance[];\n  className?: string;\n}\n\nexport const saas108Demo: Saas108Props = {\n  badge: { label: \"Talk to us\" },\n  meta: \"Five questions\",\n  heading: \"Tell us what you are building, not your company size\",\n  description:\n    \"The questions change as you answer them, so nobody gets asked about compliance for a blog or about a CMS for an internal tool.\",\n  outlineHeading: \"Scope your project\",\n  outlineDescription:\n    \"The outline on the left reshapes itself as you answer. Jump back to any step from the list.\",\n  shortcuts: \"numbers\",\n  labels: { submit: \"Send scope\", rail: \"Your outline\" },\n  confirmation: {\n    title: \"Scope sent\",\n    description:\n      \"A solutions engineer picks this up and replies with a plan within one working day.\",\n  },\n  button: {\n    label: \"Book a call instead\",\n    href: \"https://beste.co\",\n  },\n  steps: [\n    {\n      name: \"use-case\",\n      title: \"What are you building?\",\n      shortTitle: \"Project\",\n      description: \"Everything after this question follows from the answer.\",\n      required: true,\n      choices: [\n        {\n          value: \"marketing\",\n          label: \"A marketing site\",\n          description: \"Pages, campaigns, and a blog.\",\n        },\n        {\n          value: \"app\",\n          label: \"A customer-facing app\",\n          description: \"Accounts, data, and a dashboard.\",\n        },\n        {\n          value: \"internal\",\n          label: \"An internal tool\",\n          description: \"Behind the login, for staff only.\",\n        },\n      ],\n    },\n    {\n      name: \"cms\",\n      title: \"Where does the content live?\",\n      shortTitle: \"Content\",\n      required: true,\n      when: { step: \"use-case\", equals: [\"marketing\"] },\n      choices: [\n        { value: \"headless\", label: \"A headless CMS\" },\n        { value: \"files\", label: \"Markdown in the repository\" },\n        { value: \"undecided\", label: \"Not decided yet\" },\n      ],\n    },\n    {\n      name: \"compliance\",\n      title: \"Which of these do you have to satisfy?\",\n      shortTitle: \"Compliance\",\n      description: \"Pick as many as apply. This decides where the data is allowed to sit.\",\n      multiple: true,\n      when: { step: \"use-case\", equals: [\"app\", \"internal\"] },\n      choices: [\n        { value: \"soc2\", label: \"SOC 2\", description: \"Evidence collection and an annual audit.\" },\n        { value: \"hipaa\", label: \"HIPAA\", description: \"A signed BAA and a restricted region.\" },\n        { value: \"gdpr\", label: \"GDPR\", description: \"Data residency inside the EU.\" },\n        { value: \"none\", label: \"None of these yet\" },\n      ],\n    },\n    {\n      name: \"traffic\",\n      title: \"What should it hold at peak?\",\n      shortTitle: \"Scale\",\n      required: true,\n      choices: [\n        { value: \"low\", label: \"Under 10k visits a month\" },\n        { value: \"mid\", label: \"10k to 500k visits a month\" },\n        { value: \"high\", label: \"More than 500k visits a month\" },\n      ],\n    },\n    {\n      name: \"timeline\",\n      title: \"When would you like to be live?\",\n      shortTitle: \"Timeline\",\n      description: \"Optional, and a rough answer is more useful than none.\",\n      input: { label: \"Target date\", placeholder: \"Early October, before the conference...\" },\n    },\n  ],\n  assurances: [\n    {\n      title: \"One working day\",\n      description: \"A solutions engineer reads the scope and replies with a plan, not a brochure.\",\n      icon: Clock,\n    },\n    {\n      title: \"No sales sequence\",\n      description: \"One reply from one person. Nothing gets added to a drip campaign.\",\n      icon: MessageSquare,\n    },\n    {\n      title: \"Only what you answered\",\n      description: \"Steps the outline closed are never sent, because they were never asked.\",\n      icon: Lock,\n    },\n  ],\n};\n\nexport function Saas108({\n  badge,\n  meta,\n  heading,\n  description,\n  outlineHeading,\n  outlineDescription,\n  steps = [],\n  shortcuts,\n  labels = {},\n  confirmation = {},\n  button,\n  assurances = [],\n  className,\n}: Saas108Props) {\n  const {\n    previous: previousLabel,\n    skip: skipLabel,\n    next: nextLabel,\n    submit: submitLabel,\n    rail: railLabel,\n    answered: answeredLabel,\n    skipped: skippedLabel,\n  } = labels;\n  const { title: confirmationTitle, description: confirmationDescription } = confirmation;\n\n  const [active, setActive] = useState(steps[0]?.name);\n  const [answers, setAnswers] = useState<Record<string, string[]>>({});\n  const [statuses, setStatuses] = useState<Record<string, string>>({});\n  const [submitted, setSubmitted] = useState(false);\n\n  /** A step with no condition is always asked; one with a condition waits for it. */\n  const isAsked = (step: OutlineStep) => {\n    const condition = step.when;\n    if (!condition) return true;\n    const given = answers[condition.step] ?? [];\n    return given.some((value) => condition.equals.includes(value));\n  };\n\n  const asked = steps.filter(isAsked);\n  const activeIndex = asked.findIndex((step) => step.name === active);\n\n  const goTo = (name: string) => {\n    setSubmitted(false);\n    setActive(name);\n  };\n\n  const markStatus = (name: string, status: string) => {\n    setStatuses((previous) =>\n      previous[name] === status ? previous : { ...previous, [name]: status }\n    );\n  };\n\n  /**\n   * The answers are mirrored here only so a later step can be gated on an\n   * earlier one. The form itself stays the source of truth on submit.\n   */\n  const recordChoice =\n    (step: OutlineStep, value: string) => (event: ChangeEvent<HTMLInputElement>) => {\n      const { checked } = event.target;\n      setSubmitted(false);\n      setAnswers((previous) => {\n        const current = previous[step.name] ?? [];\n        if (!step.multiple) {\n          return { ...previous, [step.name]: checked ? [value] : [] };\n        }\n        return {\n          ...previous,\n          [step.name]: checked\n            ? [...current, value]\n            : current.filter((entry) => entry !== value),\n        };\n      });\n    };\n\n  const handleSubmit = (event: FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    setSubmitted(true);\n  };\n\n  return (\n    <section className={cn(\"w-full py-16 md:py-24\", className)}>\n      <div className=\"mx-auto max-w-6xl px-4 md:px-6\">\n        <div className=\"flex flex-wrap items-center gap-5\">\n          {badge && <Badge6 label={badge.label} />}\n          {badge && meta && <span className=\"h-9 w-px bg-border\" />}\n          {meta && (\n            <span className=\"text-base font-bold uppercase tracking-widest text-muted-foreground\">\n              {meta}\n            </span>\n          )}\n        </div>\n\n        <div className=\"mt-6 border-b\" />\n\n        {heading && (\n          <h2 className=\"mt-10 max-w-3xl text-balance text-3xl font-bold leading-[1.05] tracking-tight text-foreground md:text-5xl\">\n            {heading}\n          </h2>\n        )}\n        {description && (\n          <p className=\"mt-6 max-w-2xl text-lg text-muted-foreground md:text-xl\">{description}</p>\n        )}\n\n        <div className=\"mt-12 grid overflow-hidden rounded-md border md:grid-cols-[minmax(0,18rem)_1fr]\">\n          <div className=\"border-b bg-muted p-6 md:border-b-0 md:border-r md:p-8\">\n            <p className=\"text-base font-bold uppercase tracking-widest text-muted-foreground\">\n              {railLabel ?? `Step ${Math.max(1, activeIndex + 1)} of ${asked.length}`}\n            </p>\n            <ol className=\"mt-6 flex flex-col gap-1\">\n              {asked.map((step, index) => {\n                const isActive = step.name === active;\n                const status = statuses[step.name];\n                const isAnswered = status === \"answered\";\n                const isSkipped = status === \"skipped\";\n                return (\n                  <li key={index}>\n                    <button\n                      type=\"button\"\n                      onClick={() => goTo(step.name)}\n                      aria-current={isActive ? \"step\" : undefined}\n                      className={cn(\n                        \"flex w-full cursor-pointer items-center gap-3 rounded-md px-3 py-2.5 text-left text-base font-bold transition-colors\",\n                        isActive\n                          ? \"bg-background text-foreground\"\n                          : \"text-muted-foreground hover:bg-background/60 hover:text-foreground\"\n                      )}\n                    >\n                      <span\n                        aria-hidden=\"true\"\n                        className={cn(\n                          \"flex size-7 shrink-0 items-center justify-center rounded-md text-base tabular-nums\",\n                          isAnswered\n                            ? \"bg-primary text-primary-foreground\"\n                            : isActive\n                              ? \"bg-foreground text-background\"\n                              : \"border text-muted-foreground\"\n                        )}\n                      >\n                        {isAnswered ? (\n                          <Check className=\"size-4\" />\n                        ) : isSkipped ? (\n                          <span className=\"h-px w-3 bg-current\" />\n                        ) : (\n                          index + 1\n                        )}\n                      </span>\n                      <span className=\"min-w-0 flex-1 truncate\">\n                        {step.shortTitle ?? step.title}\n                      </span>\n                      {(isAnswered || isSkipped) && !isActive && (\n                        <span className=\"sr-only\">\n                          {isAnswered ? (answeredLabel ?? \"Answered\") : (skippedLabel ?? \"Skipped\")}\n                        </span>\n                      )}\n                    </button>\n                  </li>\n                );\n              })}\n            </ol>\n          </div>\n\n          <div className=\"p-6 md:p-10\">\n            {(outlineHeading || outlineDescription) && (\n              <div className=\"mb-8 border-b pb-6\">\n                {outlineHeading && (\n                  <p className=\"text-xl font-bold tracking-tight text-foreground md:text-2xl\">\n                    {outlineHeading}\n                  </p>\n                )}\n                {outlineDescription && (\n                  <p className=\"mt-3 max-w-xl text-base text-muted-foreground md:text-lg\">\n                    {outlineDescription}\n                  </p>\n                )}\n              </div>\n            )}\n\n            <Questionnaire\n              item={active}\n              onItemChange={goTo}\n              shortcuts={shortcuts}\n              onSubmit={handleSubmit}\n              className=\"gap-6\"\n            >\n              {submitted && (\n                <div role=\"status\" className=\"flex items-start gap-4 rounded-md border bg-muted p-5\">\n                  <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground\">\n                    <CheckCircle2 className=\"size-5\" />\n                  </span>\n                  <div className=\"min-w-0\">\n                    <p className=\"text-lg font-bold tracking-tight text-foreground\">\n                      {confirmationTitle ?? \"Answers sent\"}\n                    </p>\n                    {confirmationDescription && (\n                      <p className=\"mt-2 text-base text-muted-foreground\">\n                        {confirmationDescription}\n                      </p>\n                    )}\n                    {button && (\n                      <div className=\"mt-5\">\n                        <Button1 asChild label={button.label}>\n                          <Link href={button.href} />\n                        </Button1>\n                      </div>\n                    )}\n                  </div>\n                </div>\n              )}\n\n              {steps.map((step, index) => (\n                <QuestionnaireItem\n                  key={index}\n                  name={step.name}\n                  required={step.required}\n                  multiple={step.multiple}\n                  disabled={!isAsked(step)}\n                  onStatusChange={(status: string) => markStatus(step.name, status)}\n                >\n                  <QuestionnaireTitle className=\"text-xl font-bold tracking-tight text-foreground md:text-2xl\">\n                    {step.title}\n                  </QuestionnaireTitle>\n                  {step.description && (\n                    <QuestionnaireDescription className=\"text-base text-muted-foreground md:text-lg\">\n                      {step.description}\n                    </QuestionnaireDescription>\n                  )}\n                  <QuestionnaireChoices>\n                    {step.choices?.map((choice, choiceIndex) => (\n                      <QuestionnaireChoice\n                        key={choiceIndex}\n                        value={choice.value}\n                        onChange={recordChoice(step, choice.value)}\n                        className=\"rounded-md p-4 text-base data-checked:border-primary\"\n                      >\n                        <span className=\"font-bold text-foreground\">{choice.label}</span>\n                        {choice.description && (\n                          <QuestionnaireChoiceDescription className=\"text-base\">\n                            {choice.description}\n                          </QuestionnaireChoiceDescription>\n                        )}\n                      </QuestionnaireChoice>\n                    ))}\n                    {step.input && (\n                      <QuestionnaireInput\n                        aria-label={step.input.label}\n                        placeholder={step.input.placeholder}\n                        className=\"h-11 rounded-md px-4 text-base md:text-base\"\n                      />\n                    )}\n                  </QuestionnaireChoices>\n                  <QuestionnaireError className=\"text-base\" />\n                </QuestionnaireItem>\n              ))}\n\n              <QuestionnaireActions>\n                <QuestionnairePrevious className=\"cursor-pointer rounded-md text-base\">\n                  {previousLabel}\n                </QuestionnairePrevious>\n                <QuestionnaireSkip className=\"cursor-pointer rounded-md text-base\">\n                  {skipLabel}\n                </QuestionnaireSkip>\n                <QuestionnaireNext className=\"cursor-pointer rounded-md text-base\">\n                  {nextLabel}\n                </QuestionnaireNext>\n                <QuestionnaireSubmit className=\"cursor-pointer rounded-md text-base\">\n                  {submitLabel}\n                </QuestionnaireSubmit>\n              </QuestionnaireActions>\n            </Questionnaire>\n          </div>\n        </div>\n\n        {assurances.length > 0 && (\n          <div className=\"mt-10 grid gap-6 sm:grid-cols-3\">\n            {assurances.map((assurance, index) => {\n              const Icon = assurance.icon;\n              return (\n                <div key={index} className=\"rounded-md border bg-muted p-6\">\n                  {Icon && (\n                    <span className=\"mb-4 flex size-10 items-center justify-center rounded-md bg-primary text-primary-foreground\">\n                      <Icon className=\"size-5\" />\n                    </span>\n                  )}\n                  <p className=\"text-lg font-bold tracking-tight text-foreground\">\n                    {assurance.title}\n                  </p>\n                  <p className=\"mt-2 text-base text-muted-foreground\">{assurance.description}</p>\n                </div>\n              );\n            })}\n          </div>\n        )}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/beste/block/saas108.tsx"
    },
    {
      "path": "registry-components/badge6/badge6.tsx",
      "content": "import { cn } from \"@/lib/utils\";\n\ntype Tone = \"primary\" | \"foreground\" | \"muted\";\ntype Badge6Orientation = \"horizontal\" | \"vertical\";\n\ninterface Badge6Props {\n  /** Eyebrow label (rendered uppercase) */\n  label: string;\n  /** Accent square color */\n  tone?: Tone;\n  /** Layout: square beside the label (default) or stacked above it */\n  orientation?: Badge6Orientation;\n  /** Override the label classes, e.g. \"text-background/70\" on dark surfaces */\n  labelClassName?: string;\n  /** Additional classes merged onto the root */\n  className?: string;\n}\n\nconst toneStyles: Record<Tone, string> = {\n  primary: \"bg-primary\",\n  foreground: \"bg-foreground\",\n  muted: \"bg-muted-foreground\",\n};\n\nexport const badge6Demo: Badge6Props = {\n  label: \"About Us\",\n};\n\nexport function Badge6({\n  label,\n  tone = \"primary\",\n  orientation = \"horizontal\",\n  labelClassName,\n  className,\n}: Badge6Props) {\n  const vertical = orientation === \"vertical\";\n\n  return (\n    <div className={cn(\"flex\", vertical ? \"flex-col gap-3\" : \"items-center gap-2.5\", className)}>\n      <span className={cn(\"size-2.5 shrink-0\", toneStyles[tone])} />\n      <span\n        className={cn(\n          \"text-base font-bold uppercase tracking-widest text-muted-foreground\",\n          vertical && \"leading-tight\",\n          labelClassName\n        )}\n      >\n        {label}\n      </span>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/beste/component/badge6.tsx"
    },
    {
      "path": "registry-components/button1/button1.tsx",
      "content": "\"use client\";\n\nimport { ArrowRight, type LucideIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\ntype Tone = \"dark\" | \"primary\";\n\ninterface Button1Props {\n  /** Button label */\n  label: string;\n  /**\n   * Compose the rendered element shadcn-style (radix asChild):\n   * `<Button1 asChild label=\"Read More\"><Link href=\"/x\" /></Button1>`\n   * The child element receives the pill content (label + seal) as its\n   * children, so pass it without children of its own.\n   */\n  asChild?: boolean;\n  /** The element to render when `asChild` is set (e.g. your router's Link) */\n  children?: React.ReactElement;\n  /**\n   * Fallback link: renders a plain `<a>`. Prefer `asChild` with your\n   * framework's Link component for client-side navigation.\n   */\n  href?: string;\n  /** Trailing seal icon (defaults to ArrowRight) */\n  icon?: LucideIcon;\n  /** Surface tone: dark pill (default) or primary pill (for dark backgrounds) */\n  tone?: Tone;\n  /** Fully round the pill and seal (shorthand for className=\"rounded-full\") */\n  roundedFull?: boolean;\n  /** Click handler (used when there is no href and no asChild) */\n  onClick?: React.MouseEventHandler<HTMLButtonElement>;\n  /** Additional classes merged onto the button */\n  className?: string;\n}\n\nconst toneStyles: Record<Tone, { pill: string; seal: string }> = {\n  dark: {\n    pill: \"bg-foreground text-background hover:bg-foreground/90\",\n    seal: \"bg-primary text-primary-foreground\",\n  },\n  primary: {\n    pill: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n    seal: \"bg-primary-foreground text-primary\",\n  },\n};\n\nexport const button1Demo: Button1Props = {\n  label: \"Read More\",\n};\n\nexport function Button1({\n  label,\n  asChild = false,\n  children,\n  href,\n  icon: Icon = ArrowRight,\n  tone = \"dark\",\n  roundedFull = false,\n  onClick,\n  className,\n}: Button1Props) {\n  const styles = toneStyles[tone];\n\n  // Mirror the pill's border radius onto the seal so the arrow chip always\n  // matches the pill. Priority: an explicit `rounded-*` in className wins,\n  // then the `roundedFull` shorthand, otherwise the default rounded-md.\n  const explicitRadius = className?.match(/\\brounded-(?:none|sm|md|lg|xl|2xl|3xl|full)\\b/)?.[0];\n  const sealRadius = explicitRadius ?? (roundedFull ? \"rounded-full\" : \"rounded-md\");\n\n  const inner = (\n    <>\n      {label}\n      <span\n        className={cn(\n          \"flex size-8 items-center justify-center transition-transform motion-safe:group-hover/button1:translate-x-0.5\",\n          sealRadius,\n          styles.seal\n        )}\n      >\n        <Icon className=\"size-4\" />\n      </span>\n    </>\n  );\n\n  const classes = cn(\n    // justify-between keeps the label left and the seal pinned right when the\n    // pill is full-width; at w-fit there's no free space so they stay together.\n    \"group/button1 h-auto w-fit justify-between gap-3 rounded-md py-3 pl-6 pr-3 text-base font-bold transition-colors\",\n    roundedFull && \"rounded-full\",\n    styles.pill,\n    className\n  );\n\n  if (asChild && React.isValidElement(children)) {\n    // The consumer's element (e.g. next/link's <Link href>) becomes the\n    // rendered element; the pill content is injected as its children.\n    return (\n      <Button asChild className={classes}>\n        {React.cloneElement(children, undefined, inner)}\n      </Button>\n    );\n  }\n\n  if (href) {\n    return (\n      <Button asChild className={classes}>\n        <a href={href}>{inner}</a>\n      </Button>\n    );\n  }\n\n  return (\n    <Button type=\"button\" className={classes} onClick={onClick}>\n      {inner}\n    </Button>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/beste/component/button1.tsx"
    }
  ],
  "type": "registry:block"
}