{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "onboarding-checklist",
  "title": "Onboarding Checklist",
  "description": "First-run setup with a true progress count: a list as its own screen, a slim row above the page, or welcome steps one at a time in a dialog.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "utils",
    "https://miseui.junsu4621.workers.dev/r/button.json",
    "https://miseui.junsu4621.workers.dev/r/checkbox.json",
    "https://miseui.junsu4621.workers.dev/r/dialog.json",
    "https://miseui.junsu4621.workers.dev/r/progress.json"
  ],
  "files": [
    {
      "path": "registry/miseui/blocks/onboarding-checklist.tsx",
      "content": "import type * as React from \"react\"\nimport { Landmark, Send, Store, UserPlus } from \"lucide-react\"\nimport { OnboardingBanner } from \"./onboarding-checklist-banner\"\nimport { OnboardingDialog } from \"./onboarding-checklist-dialog\"\nimport { OnboardingPanel } from \"./onboarding-checklist-panel\"\nimport type { OnboardingStep } from \"./onboarding-checklist-state\"\n\ntype OnboardingChecklistVariant = \"panel\" | \"banner\" | \"dialog\"\n\nconst DEFAULT_STEPS: readonly OnboardingStep[] = [\n  { id: \"workspace\", title: \"Name your workspace\", description: \"It appears on every invoice you send.\", actionLabel: \"Name it\", icon: Store },\n  { id: \"bank\", title: \"Connect your bank\", description: \"Payments land here, and you can change it later.\", actionLabel: \"Connect\", icon: Landmark },\n  { id: \"invoice\", title: \"Send a test invoice\", description: \"It goes only to you, so nothing real moves.\", actionLabel: \"Send a test\", icon: Send },\n  { id: \"invite\", title: \"Invite your accountant\", description: \"They can read the books and cannot move money.\", actionLabel: \"Invite\", icon: UserPlus },\n]\n\nconst NOTHING_DONE: readonly string[] = []\n\ninterface OnboardingChecklistProps extends Omit<React.ComponentProps<\"section\">, \"title\"> {\n  /** `panel` the list as its own screen, `banner` a slim row above your page, `dialog` one step at a time on a first visit. Anything else is `panel`. */\n  variant?: OnboardingChecklistVariant\n  title?: string\n  /** Continues the title, one tone quieter. On `banner` it is shown once every step is done. */\n  description?: string\n  steps?: readonly OnboardingStep[]\n  /** Ids of finished steps. Pass it to decide yourself when a step counts as done; leave it out and pressing a step's button ticks it. */\n  completed?: readonly string[]\n  /** What is really done already. Progress starts at this count and never above it, so do not seed it to flatter the bar. */\n  defaultCompleted?: readonly string[]\n  onCompletedChange?: (completed: readonly string[]) => void\n  /** Runs when a step's button is pressed. Return a promise to get the loading state; a rejection's message is shown beside the step. */\n  onStep?: (id: string) => void | Promise<void>\n  /** The button once everything is done. */\n  finishLabel?: string\n  onFinish?: () => void\n  /** Hiding is remembered by you: save it and stop rendering this. `panel` only offers the button when this is passed. */\n  onDismiss?: () => void\n  /** `dialog` only. */\n  open?: boolean\n  /** `dialog` only. A welcome greets on arrival, so it starts open. */\n  defaultOpen?: boolean\n  onOpenChange?: (open: boolean) => void\n}\n\nfunction OnboardingChecklist({\n  variant,\n  title = \"Finish setting up Paperline.\",\n  description = \"A few minutes, in any order.\",\n  steps = DEFAULT_STEPS,\n  completed,\n  defaultCompleted = NOTHING_DONE,\n  finishLabel = \"Open Paperline\",\n  open,\n  defaultOpen,\n  onOpenChange,\n  ...props\n}: OnboardingChecklistProps) {\n  const shared = { title, description, steps, completed, defaultCompleted, finishLabel, ...props }\n  if (variant === \"banner\") return <OnboardingBanner {...shared} />\n  if (variant === \"dialog\") return <OnboardingDialog {...shared} open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} />\n  return <OnboardingPanel {...shared} />\n}\n\nexport { OnboardingChecklist, type OnboardingChecklistProps, type OnboardingChecklistVariant, type OnboardingStep }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/onboarding-checklist-banner.tsx",
      "content": "import { useRef, useState } from \"react\"\nimport { Loader2, X } from \"lucide-react\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { Progress } from \"@/registry/miseui/ui/progress\"\nimport { INK_FILL_CLASS, type OnboardingViewProps } from \"./onboarding-checklist-panel\"\nimport { useOnboarding, type Onboarding } from \"./onboarding-checklist-state\"\n\nfunction BannerText({ onboarding, finishNote }: { onboarding: Onboarding; finishNote: string }) {\n  return (\n    <div className=\"min-w-0 @2xl:flex-1\">\n      <p role=\"status\" className=\"text-[13px] leading-5 text-pretty\">\n        <span className=\"font-medium tabular-nums\">\n          {onboarding.doneCount} of {onboarding.total} done.\n        </span>{\" \"}\n        <span className=\"text-muted-foreground\">{onboarding.next ? `Next: ${onboarding.next.title}` : finishNote}</span>\n      </p>\n      {onboarding.failure ? (\n        <p role=\"alert\" className=\"text-[13px] leading-5 text-pretty text-destructive\">\n          {onboarding.failure.message}\n        </p>\n      ) : null}\n    </div>\n  )\n}\n\n/** A row of its own at the top of the page: the work stays the main thing, and the next step is one press away. */\nfunction OnboardingBanner({ steps, completed, defaultCompleted, onCompletedChange, onStep, finishLabel, onFinish, onDismiss, title, description, className, children, ...props }: OnboardingViewProps) {\n  const onboarding = useOnboarding({ steps, completed, defaultCompleted, onCompletedChange, onStep })\n  const [hidden, setHidden] = useState(false)\n  const rootRef = useRef<HTMLElement>(null)\n  const next = onboarding.next\n  const pending = next !== undefined && onboarding.pendingId === next.id\n\n  const hide = () => {\n    setHidden(true)\n    onDismiss?.()\n    // The button that had focus just left with the row. The page below is where they are going.\n    rootRef.current?.focus()\n  }\n\n  return (\n    <section ref={rootRef} tabIndex={-1} data-slot=\"onboarding-checklist\" data-variant=\"banner\" className={cn(\"@container w-full outline-none\", className)} {...props}>\n      {hidden ? null : (\n        <div role=\"region\" aria-label={title} data-slot=\"onboarding-banner\" className=\"relative border-b bg-background\">\n          <div className=\"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-1 py-2 ps-4 pe-2 @2xl:flex @2xl:gap-4 @2xl:pe-3\">\n            <BannerText onboarding={onboarding} finishNote={description} />\n            {next ? (\n              <Button\n                variant=\"mise\"\n                size=\"sm\"\n                aria-busy={pending || undefined}\n                aria-disabled={pending || undefined}\n                onClick={() => void onboarding.press(next.id)}\n                className=\"col-start-1 row-start-2 justify-self-start pointer-coarse:h-10\"\n              >\n                {pending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n                {next.actionLabel}\n              </Button>\n            ) : (\n              <Button\n                variant=\"mise\"\n                size=\"sm\"\n                onClick={() => {\n                  onFinish?.()\n                  hide()\n                }}\n                className=\"col-start-1 row-start-2 justify-self-start pointer-coarse:h-10\"\n              >\n                {finishLabel}\n              </Button>\n            )}\n            <Button variant=\"ghost\" size=\"icon\" aria-label=\"Hide setup for now\" onClick={hide} className=\"col-start-2 row-start-1 size-8 pointer-coarse:size-10\">\n              <X aria-hidden=\"true\" />\n            </Button>\n          </div>\n          {/* The row's own bottom edge is the bar, so progress takes no height from the page. */}\n          <Progress variant=\"thin\" effect=\"spring\" label=\"Setup progress\" value={onboarding.doneCount} max={Math.max(onboarding.total, 1)} className={cn(\"absolute inset-x-0 -bottom-px rounded-none\", INK_FILL_CLASS)} />\n        </div>\n      )}\n      {children}\n    </section>\n  )\n}\n\nexport { OnboardingBanner }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/onboarding-checklist-dialog.tsx",
      "content": "import { useEffect, useRef, useState } from \"react\"\nimport { Check, Hand, Loader2, X } from \"lucide-react\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { Dialog, DialogClose, DialogContent, DialogTitle, DialogTrigger } from \"@/registry/miseui/ui/dialog\"\nimport { Progress } from \"@/registry/miseui/ui/progress\"\nimport type { OnboardingViewProps } from \"./onboarding-checklist-panel\"\nimport { useOnboarding, type Onboarding, type OnboardingStep } from \"./onboarding-checklist-state\"\n\ninterface OnboardingDialogProps extends OnboardingViewProps {\n  /** A welcome is meant to greet people on arrival, so it starts open. Pass `open` to decide from your own first-visit flag. */\n  open?: boolean\n  defaultOpen?: boolean\n  onOpenChange?: (open: boolean) => void\n}\n\n/** Screen 0 greets, then one screen per step, then the closing one. */\nconst WELCOME_SCREEN = 0\n\nfunction nextOpenScreen(from: number, steps: readonly OnboardingStep[], done: readonly string[]) {\n  const ahead = steps.findIndex((step, index) => index + 1 > from && !done.includes(step.id))\n  return ahead === -1 ? steps.length + 1 : ahead + 1\n}\n\ninterface ScreenCopy {\n  title: string\n  description: string\n  icon: NonNullable<OnboardingStep[\"icon\"]>\n}\n\nfunction screenCopy(screen: number, step: OnboardingStep | undefined, welcome: Pick<ScreenCopy, \"title\" | \"description\">, onboarding: Onboarding): ScreenCopy {\n  if (screen === WELCOME_SCREEN) return { ...welcome, icon: Hand }\n  if (step) return { title: step.title, description: step.description, icon: step.icon ?? Hand }\n  const everything = onboarding.doneCount === onboarding.total\n  return {\n    title: everything ? \"That is everything.\" : `${onboarding.doneCount} of ${onboarding.total} done.`,\n    description: everything ? \"You are ready to start.\" : \"The rest waits behind the Setup button.\",\n    icon: Check,\n  }\n}\n\ninterface FooterProps {\n  screen: number\n  step: OnboardingStep | undefined\n  onboarding: Onboarding\n  finishLabel: string\n  onSkip: () => void\n  onPrimary: () => void\n}\n\nfunction ScreenFooter({ screen, step, onboarding, finishLabel, onSkip, onPrimary }: FooterProps) {\n  const welcome = screen === WELCOME_SCREEN\n  const closing = !welcome && !step\n  const pending = step !== undefined && onboarding.pendingId === step.id\n  return (\n    <div className=\"flex flex-wrap items-center justify-end gap-2 px-6 pb-6\">\n      {closing ? null : (\n        <Button variant=\"ghost\" onClick={onSkip} className=\"pointer-coarse:h-10\">\n          Not now\n        </Button>\n      )}\n      <Button variant=\"mise\" aria-busy={pending || undefined} aria-disabled={pending || undefined} onClick={onPrimary} className=\"pointer-coarse:h-10\">\n        {pending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n        {welcome ? \"Start\" : (step?.actionLabel ?? finishLabel)}\n      </Button>\n    </div>\n  )\n}\n\nfunction ScreenTop({ onboarding }: { onboarding: Onboarding }) {\n  const cells = Math.max(onboarding.total, 1)\n  return (\n    <div className=\"flex items-center gap-3 ps-6 pe-2 pt-2\">\n      <p role=\"status\" className=\"sr-only\">\n        {onboarding.doneCount} of {onboarding.total} done\n      </p>\n      {/* In ink: the one accent in this dialog belongs to the button that moves things on. */}\n      <Progress variant=\"segmented\" effect=\"spring\" label=\"Setup progress\" value={onboarding.doneCount} max={cells} steps={cells} className=\"flex-1 [&_[data-slot=progress-segment]>span]:bg-foreground\" />\n      <DialogClose asChild>\n        <Button variant=\"ghost\" size=\"icon\" aria-label=\"Close\" className=\"size-10\">\n          <X aria-hidden=\"true\" />\n        </Button>\n      </DialogClose>\n    </div>\n  )\n}\n\ninterface WelcomeDialogProps extends Pick<OnboardingDialogProps, \"steps\" | \"title\" | \"description\" | \"finishLabel\" | \"onFinish\"> {\n  onboarding: Onboarding\n  onClose: () => void\n}\n\nfunction WelcomeDialog({ steps, title, description, finishLabel, onFinish, onboarding, onClose }: WelcomeDialogProps) {\n  const [screen, setScreen] = useState(WELCOME_SCREEN)\n  const titleRef = useRef<HTMLHeadingElement>(null)\n  const step = steps[screen - 1]\n  const copy = screenCopy(screen, step, { title, description }, onboarding)\n  const Icon = copy.icon\n  // The title takes focus on each new screen, so a screen reader hears the step and not silence.\n  useEffect(() => {\n    if (screen !== WELCOME_SCREEN) titleRef.current?.focus()\n  }, [screen])\n\n  const pressStep = async (id: string) => {\n    const index = steps.findIndex((item) => item.id === id)\n    if (await onboarding.press(id)) setScreen(nextOpenScreen(index + 1, steps, [...onboarding.done, id]))\n  }\n  const primary = () => {\n    if (screen === WELCOME_SCREEN) return setScreen(nextOpenScreen(0, steps, onboarding.done))\n    if (step) return void pressStep(step.id)\n    onFinish?.()\n    onClose()\n  }\n  const skip = () => (screen === WELCOME_SCREEN ? onClose() : setScreen(nextOpenScreen(screen, steps, onboarding.done)))\n\n  return (\n    <DialogContent\n      showCloseButton={false}\n      aria-describedby={undefined}\n      onOpenAutoFocus={(event) => {\n        event.preventDefault()\n        titleRef.current?.focus()\n      }}\n      className=\"gap-0 rounded-2xl p-0 sm:max-w-md\"\n    >\n      <ScreenTop onboarding={onboarding} />\n      <div className=\"flex flex-col gap-4 px-6 pt-6 pb-8\">\n        <span aria-hidden=\"true\" className=\"grid size-12 place-items-center rounded-2xl bg-muted text-muted-foreground\">\n          <Icon className=\"size-6\" />\n        </span>\n        <DialogTitle ref={titleRef} tabIndex={-1} className=\"text-display text-2xl leading-[1.12]! text-balance outline-none\">\n          {copy.title} <span className=\"block text-muted-foreground\">{copy.description}</span>\n        </DialogTitle>\n        {onboarding.failure ? (\n          <p role=\"alert\" className=\"text-[13px] leading-snug text-pretty text-destructive\">\n            {onboarding.failure.message}\n          </p>\n        ) : null}\n      </div>\n      <ScreenFooter screen={screen} step={step} onboarding={onboarding} finishLabel={finishLabel} onSkip={skip} onPrimary={primary} />\n    </DialogContent>\n  )\n}\n\n/** One thing at a time, for a first visit where a whole list would read as homework. Closing it loses nothing: the Setup button stays on the page. */\nfunction OnboardingDialog({ steps, completed, defaultCompleted, onCompletedChange, onStep, title, description, finishLabel, onFinish, onDismiss, open, defaultOpen = true, onOpenChange, className, children, ...props }: OnboardingDialogProps) {\n  const onboarding = useOnboarding({ steps, completed, defaultCompleted, onCompletedChange, onStep })\n  const [uncontrolled, setUncontrolled] = useState(defaultOpen)\n  const setOpen = (next: boolean) => {\n    setUncontrolled(next)\n    onOpenChange?.(next)\n    if (!next) onDismiss?.()\n  }\n  return (\n    <section data-slot=\"onboarding-checklist\" data-variant=\"dialog\" aria-label=\"Setup\" className={cn(\"@container relative min-h-[640px] w-full\", className)} {...props}>\n      {children}\n      <Dialog open={open ?? uncontrolled} onOpenChange={setOpen}>\n        <DialogTrigger asChild>\n          <Button variant=\"outline\" className=\"absolute end-4 bottom-4 tabular-nums shadow-md pointer-coarse:h-10 dark:shadow-black/40\">\n            Setup, {onboarding.doneCount} of {onboarding.total} done\n          </Button>\n        </DialogTrigger>\n        <WelcomeDialog {...{ steps, title, description, finishLabel, onFinish, onboarding }} onClose={() => setOpen(false)} />\n      </Dialog>\n    </section>\n  )\n}\n\nexport { nextOpenScreen, OnboardingDialog, type OnboardingDialogProps }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/onboarding-checklist-panel.tsx",
      "content": "import type * as React from \"react\"\nimport { useEffect, useId, useRef, useState } from \"react\"\nimport { ChevronDown, Loader2 } from \"lucide-react\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { Checkbox } from \"@/registry/miseui/ui/checkbox\"\nimport { Progress } from \"@/registry/miseui/ui/progress\"\nimport { useOnboarding, type Onboarding, type OnboardingOptions, type OnboardingStep } from \"./onboarding-checklist-state\"\n\nconst FOCUS_NEXT_SELECTOR = \"[data-focus-next]\"\n/** In ink: the one accent on this screen belongs to the next thing to press. */\nconst INK_FILL_CLASS = \"[&_[data-slot=progress-fill]]:bg-foreground\"\n\ninterface OnboardingViewProps extends Omit<React.ComponentProps<\"section\">, \"title\">, OnboardingOptions {\n  title: string\n  description: string\n  finishLabel: string\n  onFinish?: () => void\n  onDismiss?: () => void\n}\n\ninterface StepRowProps {\n  step: OnboardingStep\n  onboarding: Onboarding\n  open: boolean\n  onOpen: () => void\n  onPress: () => void\n}\n\nfunction StepBody({ step, onboarding, onPress, id }: Pick<StepRowProps, \"step\" | \"onboarding\" | \"onPress\"> & { id: string }) {\n  const next = onboarding.next?.id === step.id\n  const pending = onboarding.pendingId === step.id\n  const failed = onboarding.failure?.id === step.id\n  return (\n    <div id={id} className=\"flex flex-col items-start gap-3 pb-3\">\n      <p className=\"text-[13px] leading-relaxed text-pretty text-muted-foreground\">{step.description}</p>\n      {failed ? (\n        <p role=\"alert\" className=\"text-[13px] leading-snug text-pretty text-destructive\">\n          {onboarding.failure?.message}\n        </p>\n      ) : null}\n      {/* aria-disabled and not disabled: a disabled button drops keyboard focus while the work runs. */}\n      <Button\n        variant={next ? \"mise\" : \"outline\"}\n        data-focus-next={next ? \"\" : undefined}\n        aria-busy={pending || undefined}\n        aria-disabled={onboarding.pendingId !== null || undefined}\n        onClick={onPress}\n        className=\"pointer-coarse:h-10\"\n      >\n        {pending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n        {step.actionLabel}\n      </Button>\n    </div>\n  )\n}\n\nfunction StepRow({ step, onboarding, open, onOpen, onPress }: StepRowProps) {\n  const bodyId = useId()\n  const done = onboarding.done.includes(step.id)\n  return (\n    <li data-state={done ? \"done\" : open ? \"open\" : \"closed\"} className=\"grid grid-cols-[auto_minmax(0,1fr)] gap-x-1 px-2 py-1 @3xl:px-3\">\n      {/* The label is the hit target: a 16 px box stays 16 px while the press area reaches 40. */}\n      <label className=\"inline-flex size-10 cursor-pointer items-center justify-center self-start\">\n        <Checkbox aria-label={step.title} checked={done} disabled={onboarding.pendingId !== null} onCheckedChange={(state) => onboarding.setDone(step.id, state === true)} />\n      </label>\n      <div className=\"min-w-0 pe-2\">\n        {done ? (\n          <p className=\"flex min-h-10 items-center text-[15px] text-pretty text-muted-foreground\">{step.title}</p>\n        ) : (\n          <button\n            type=\"button\"\n            aria-expanded={open}\n            aria-controls={open ? bodyId : undefined}\n            onClick={onOpen}\n            className=\"flex min-h-10 w-full items-center justify-between gap-2 rounded-md text-start text-[15px] text-pretty outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50\"\n          >\n            <span className=\"min-w-0\">{step.title}</span>\n            <ChevronDown aria-hidden=\"true\" className={cn(\"size-4 shrink-0 text-muted-foreground transition-transform duration-(--duration-fast) ease-(--ease-mise) motion-reduce:transition-none\", open && \"rotate-180\")} />\n          </button>\n        )}\n        {open && !done ? <StepBody id={bodyId} step={step} onboarding={onboarding} onPress={onPress} /> : null}\n      </div>\n    </li>\n  )\n}\n\n/** The pressed button goes away with its row, which would drop keyboard focus onto the page. */\nfunction useFocusAfterStep(plate: React.RefObject<HTMLDivElement | null>, doneCount: number) {\n  const pendingRef = useRef(false)\n  useEffect(() => {\n    if (!pendingRef.current) return\n    pendingRef.current = false\n    plate.current?.querySelector<HTMLElement>(FOCUS_NEXT_SELECTOR)?.focus()\n  }, [doneCount, plate])\n  return pendingRef\n}\n\nfunction StepsPlate({ steps, onboarding, finish }: { steps: readonly OnboardingStep[]; onboarding: Onboarding; finish: React.ReactNode }) {\n  const plateRef = useRef<HTMLDivElement>(null)\n  const pendingFocusRef = useFocusAfterStep(plateRef, onboarding.doneCount)\n  const [chosenId, setChosenId] = useState<string | null>(null)\n  const chosenOpen = chosenId !== null && !onboarding.done.includes(chosenId)\n  const openId = chosenOpen ? chosenId : onboarding.next?.id\n\n  const pressStep = async (id: string) => {\n    pendingFocusRef.current = true\n    const finished = await onboarding.press(id)\n    // Failed: the row stays open, with its message, whichever row that is.\n    if (finished) setChosenId(null)\n    else pendingFocusRef.current = false\n  }\n\n  return (\n    <div ref={plateRef} className=\"min-w-0 rounded-2xl border bg-background dark:bg-card\">\n      {steps.length > 0 ? (\n        <ol className=\"flex flex-col divide-y\">\n          {steps.map((step) => (\n            <StepRow\n              key={step.id}\n              step={step}\n              onboarding={onboarding}\n              open={openId === step.id}\n              onOpen={() => setChosenId(openId === step.id ? \"\" : step.id)}\n              onPress={() => void pressStep(step.id)}\n            />\n          ))}\n        </ol>\n      ) : null}\n      {onboarding.allDone ? (\n        <div className={cn(\"flex flex-wrap items-center justify-between gap-3 p-4\", steps.length > 0 && \"border-t\")}>\n          <p className=\"text-[15px]\">That is everything.</p>\n          {finish}\n        </div>\n      ) : null}\n    </div>\n  )\n}\n\n/** Heading and count stay beside the list on wide screens, so the end stays in sight while a step is open. */\nfunction OnboardingPanel({ steps, completed, defaultCompleted, onCompletedChange, onStep, title, description, finishLabel, onFinish, onDismiss, className, ...props }: OnboardingViewProps) {\n  const onboarding = useOnboarding({ steps, completed, defaultCompleted, onCompletedChange, onStep })\n  const finish = (\n    <Button variant=\"mise\" data-focus-next=\"\" onClick={onFinish} className=\"pointer-coarse:h-10\">\n      {finishLabel}\n    </Button>\n  )\n  return (\n    <section data-slot=\"onboarding-checklist\" data-variant=\"panel\" aria-label=\"Setup\" className={cn(\"@container flex w-full flex-col bg-muted dark:bg-background\", className)} {...props}>\n      <div className=\"flex min-h-[640px] flex-1 items-center px-4 py-12 @3xl:px-8\">\n        <div className=\"mx-auto grid w-full max-w-4xl grid-cols-[minmax(0,1fr)] items-start gap-8 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] @3xl:gap-12\">\n          <div className=\"flex min-w-0 flex-col gap-6\">\n            <h2 className=\"text-display text-3xl leading-[1.12]! text-balance\">\n              {title} <span className=\"text-muted-foreground\">{description}</span>\n            </h2>\n            {onboarding.total > 0 ? (\n              <div className=\"flex flex-col gap-2\">\n                <p role=\"status\" className=\"text-[13px] text-muted-foreground tabular-nums\">\n                  {onboarding.doneCount} of {onboarding.total} done\n                </p>\n                <Progress label=\"Setup progress\" effect=\"spring\" value={onboarding.doneCount} max={onboarding.total} className={INK_FILL_CLASS} />\n              </div>\n            ) : null}\n            {onDismiss ? (\n              <Button variant=\"ghost\" onClick={onDismiss} className=\"-ms-3 self-start text-muted-foreground pointer-coarse:h-10\">\n                Hide this for now\n              </Button>\n            ) : null}\n          </div>\n          <StepsPlate steps={steps} onboarding={onboarding} finish={finish} />\n        </div>\n      </div>\n    </section>\n  )\n}\n\nexport { INK_FILL_CLASS, OnboardingPanel, type OnboardingViewProps }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/onboarding-checklist-state.ts",
      "content": "import type * as React from \"react\"\nimport { useState } from \"react\"\n\ninterface OnboardingStep {\n  id: string\n  title: string\n  /** Continues the title, one tone quieter. Say what the step gets them, not how the screen works. */\n  description: string\n  actionLabel: string\n  icon?: React.ComponentType<{ className?: string }>\n}\n\ninterface OnboardingStepFailure {\n  id: string\n  message: string\n}\n\nconst STEP_FAILED = \"That step did not finish. Try it again.\"\n\n/** Ids that no longer match a step are not progress, so the count can never claim more than is really done. */\nfunction doneStepIds(steps: readonly OnboardingStep[], completed: readonly string[]) {\n  return steps.filter((step) => completed.includes(step.id)).map((step) => step.id)\n}\n\nfunction firstOpenStep(steps: readonly OnboardingStep[], done: readonly string[]) {\n  return steps.find((step) => !done.includes(step.id))\n}\n\ninterface OnboardingOptions {\n  steps: readonly OnboardingStep[]\n  completed?: readonly string[]\n  defaultCompleted: readonly string[]\n  onCompletedChange?: (completed: readonly string[]) => void\n  onStep?: (id: string) => void | Promise<void>\n}\n\nfunction useOnboarding({ steps, completed, defaultCompleted, onCompletedChange, onStep }: OnboardingOptions) {\n  const [internal, setInternal] = useState(defaultCompleted)\n  const [pendingId, setPendingId] = useState<string | null>(null)\n  const [failure, setFailure] = useState<OnboardingStepFailure | null>(null)\n  const current = completed ?? internal\n  const done = doneStepIds(steps, current)\n\n  const setDone = (id: string, state: boolean) => {\n    const without = current.filter((item) => item !== id)\n    const next = state ? [...without, id] : without\n    setInternal(next)\n    onCompletedChange?.(next)\n  }\n\n  /** True once the step's work went through, so a screen can move on. A controlled owner still decides what counts as done. */\n  const press = async (id: string) => {\n    if (pendingId !== null) return false\n    setFailure(null)\n    setPendingId(id)\n    try {\n      await onStep?.(id)\n      if (completed === undefined) setDone(id, true)\n      return true\n    } catch (problem) {\n      setFailure({ id, message: problem instanceof Error ? problem.message : STEP_FAILED })\n      return false\n    } finally {\n      setPendingId(null)\n    }\n  }\n\n  return {\n    done,\n    doneCount: done.length,\n    total: steps.length,\n    next: firstOpenStep(steps, done),\n    allDone: done.length === steps.length,\n    pendingId,\n    failure,\n    setDone,\n    press,\n  }\n}\n\ntype Onboarding = ReturnType<typeof useOnboarding>\n\nexport { doneStepIds, firstOpenStep, useOnboarding, type Onboarding, type OnboardingOptions, type OnboardingStep }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "blocks"
  ],
  "type": "registry:block"
}