Add the Nook "Chat Widget" component to this project, exactly as Nook ships it. A chat that opens from a button in the corner, for an assistant or for support. Steps 1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`. 2. Run `npx nook-ui@latest add chat-widget`. It writes `components/ui/chat-widget.tsx` together with everything the component needs. Do not write the component from memory. 3. If you cannot run commands, fetch http://localhost:3000/r/chat-widget.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`. 4. Use it where I ask. Start from this example: ```tsx "use client"; import * as React from "react"; import { ChatWidget, type ChatWidgetMessage } from "@/components/ui/chat-widget"; const ANSWERS: Record = { default: "You can change that in Settings, under Workspace. Want me to take you there?", "How do I invite my team?": "Open Settings, choose Members, then press Invite. Each person gets an email with a link.", "Where are my invoices?": "Invoices are under Settings, Billing. You can download each one as a PDF.", }; export default function ChatWidgetDefault() { const [messages, setMessages] = React.useState([]); const [pending, setPending] = React.useState(false); const send = (text: string) => { setMessages((list) => [...list, { id: `u${list.length}`, role: "user", content: text }]); setPending(true); setTimeout(() => { setMessages((list) => [...list, { id: `a${list.length}`, role: "assistant", content: ANSWERS[text] ?? ANSWERS.default }]); setPending(false); }, 900); }; return (
Your page
); } ``` API - `ChatWidget`: The launcher and the panel. You keep the messages and answer in `onSend`. - `messages` (`{ id; role: "user" | "assistant"; content }[]`): The conversation so far. - `onSend` (`(text: string) => void`): Called with what the person wrote or picked. - `pending` (`boolean`): Shows the typing indicator and holds back sending. - `title, description` (`string`): The panel header. - `suggestions` (`string[]`): Questions offered while the conversation is empty. - `open, defaultOpen, onOpenChange` (`boolean, boolean, (open) => void`): Control whether it is open. - `ChatComposer`: The message field on its own, for a full-page chat. - `onSend` (`(text: string) => void`): Called with the trimmed text. - `busy` (`boolean`): Holds back sending. - `actions` (`ReactNode`): Extra controls before the send button. Rules - Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them. - Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme. - It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles. - Accessibility: The button opens a named panel and focus moves into it; Escape closes it and returns focus. New answers are announced. Enter sends and Shift Enter starts a new line. Done when the component renders like the example in light and dark mode and the project type-checks.