From 33ae8f9ba84ddae812a07ea6afa8859bcd814f90 Mon Sep 17 00:00:00 2001 From: Simon Farshid Date: Tue, 25 Jun 2024 22:45:14 -0700 Subject: [PATCH] feat: AssistantModalPrimitive (#321) --- .changeset/rich-lizards-rule.md | 5 + .../reference/primitives/AssistantModal.mdx | 119 ++++++++++++++++++ apps/www/pages/reference/primitives/_meta.tsx | 4 + packages/react/package.json | 2 + .../assistantModal/AssistantModalContent.tsx | 47 +++++++ .../assistantModal/AssistantModalRoot.tsx | 44 +++++++ .../assistantModal/AssistantModalTrigger.tsx | 23 ++++ .../src/primitives/assistantModal/index.ts | 3 + packages/react/src/primitives/index.ts | 9 +- packages/shadcn-registry/registry/registry.ts | 2 +- pnpm-lock.yaml | 6 + 11 files changed, 259 insertions(+), 5 deletions(-) create mode 100644 .changeset/rich-lizards-rule.md create mode 100644 apps/www/pages/reference/primitives/AssistantModal.mdx create mode 100644 packages/react/src/primitives/assistantModal/AssistantModalContent.tsx create mode 100644 packages/react/src/primitives/assistantModal/AssistantModalRoot.tsx create mode 100644 packages/react/src/primitives/assistantModal/AssistantModalTrigger.tsx create mode 100644 packages/react/src/primitives/assistantModal/index.ts diff --git a/.changeset/rich-lizards-rule.md b/.changeset/rich-lizards-rule.md new file mode 100644 index 000000000..111d4cd08 --- /dev/null +++ b/.changeset/rich-lizards-rule.md @@ -0,0 +1,5 @@ +--- +"@assistant-ui/react": patch +--- + +feat: AssistantModalPrimitive diff --git a/apps/www/pages/reference/primitives/AssistantModal.mdx b/apps/www/pages/reference/primitives/AssistantModal.mdx new file mode 100644 index 000000000..8fb9b3017 --- /dev/null +++ b/apps/www/pages/reference/primitives/AssistantModal.mdx @@ -0,0 +1,119 @@ +--- +title: AssistantModalPrimitive +description: A modal chat UI usually displayed in the bottom right corner of the screen. +--- + +import { Code } from "@radix-ui/themes"; +import { ParametersTable, DataAttributesTable } from "@/components/docs"; + +## Anatomy + +```tsx +import { AssistantModalPrimitive } from "@assistant-ui/react"; + +const Thread = () => ( + + + + + + + + +); +``` + +## API Reference + +### Root + +Contains all parts of the assistant modal. + + void", + description: "Event handler called when the open state of the assistant modal changes.", + }, + { + name: "modal", + type: "boolean", + default: "false", + description: "The modality of the assistant modal. When set to true, interaction with outside elements will be disabled and only modal content will be visible to screen readers." + } + ]} +/> + +### Trigger + +A button that toggles the open state of the assistant modal. `AssistantModalPrimitive.Content` will position itself against this button. + +This primitive renders a `