feat: implement Thread viewport with radix-ui scroll-area primitives
Addresses #1125
[!IMPORTANT] Implement Thread viewport using Radix UI scroll-area primitives, adding new components and updating existing ones.
- Components:
- Implement
ScrollAreaandScrollBarcomponents inscroll-area.tsxusing@radix-ui/react-scroll-area.- Update
ThreadPrimitiveRootinThreadRoot.tsxto useScrollAreaPrimitive.Rootand includeScrollBar.- Update
ThreadPrimitiveViewportinThreadViewport.tsxto useScrollAreaPrimitive.Viewport.- Dependencies:
- Add
@radix-ui/react-scroll-areaversion1.2.1topackage.jsonin bothapps/registryandpackages/react.- Misc:
- Remove
Scrollbar.mdxdocumentation file.This description was created by
for 448efd6906a824c59abbf00c9d0c7313a26c1131. It will automatically update as commits are pushed.
@PieterT2000 is attempting to deploy a commit to the assistant-ui Team on Vercel.
A member of the Team first needs to authorize it.
LGTM :+1:
π Documentation updates detected! You can review documentation updates here
Promptless's comment below:
The PR implements a significant change to the Thread component's scrollbar functionality, making it a built-in feature using Radix UI's scroll-area primitives. I've made the following documentation updates:
- Updated the Thread.mdx documentation to reflect that the Root component now uses Radix UI's ScrollArea.Root by default
- Updated the Viewport component documentation to indicate it uses ScrollArea.Viewport
- Added information about the built-in custom scrollbar functionality
- Fixed a typo in "Contains" (was "Containts")
The old Scrollbar.mdx documentation file has been removed as part of the PR since the functionality is now built into the core components. No additional documentation updates are needed since the feature is now handled automatically by the Thread component.
Let me summarize the changes for the user.
I've updated the documentation to reflect the new built-in scrollbar functionality in the Thread component. The main changes are:
- Updated the Thread primitive documentation to show that it now includes built-in custom scrollbar functionality using Radix UI's scroll-area primitives.
- Removed the separate Scrollbar.mdx documentation since this functionality is now built into the core Thread component.
- Updated the component descriptions to reflect that Root and Viewport components now use Radix UI's ScrollArea components by default.
These changes align with the PR's implementation of Thread viewport with Radix UI scroll-area primitives, making the custom scrollbar functionality a built-in feature rather than requiring manual setup.
Walkthrough
The pull request removes the documentation file for implementing a custom scrollbar and introduces new scroll area components. A new file is added that defines ScrollArea and ScrollBar components using primitives from the @radix-ui/react-scroll-area library. The ThreadRoot and ThreadViewport components are updated to replace previous div implementations with these scroll area primitives, with corresponding updates to type definitions. In addition, a new ScrollBar component is added to another part of the codebase to manage scrollbar styling and functionality. The dependency on @radix-ui/react-scroll-area is updated in multiple package.json files to version 1.2.1, and the registry of components now includes an entry for "scroll-area". No changes were made to declarations of exported or public entities apart from the necessary updates to component references and type definitions.
[!WARNING] There were issues while running some tools. Please review the errors and either fix the toolβs configuration or disable the tool if itβs a critical failure.
π§ ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
apps/registry/components/ui/scroll-area.tsx
Oops! Something went wrong! :(
ESLint: 9.20.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.
packages/react/src/primitives/thread/ThreadViewport.tsx
Oops! Something went wrong! :(
ESLint: 9.20.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.
apps/registry/src/registry.ts
Oops! Something went wrong! :(
ESLint: 9.20.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.
- 2 others
β¨ Finishing Touches
- [ ] π Generate Docstrings (Beta)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
πͺ§ Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR. (Beta)@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@trag-bot didn't find any issues in the code! β β¨
Pull request summary
- Added documentation for integrating a custom scrollbar using
@radix-ui/react-scroll-area. - Updated the registry to include the new
scroll-areadependency. - Specified the
@radix-ui/react-scroll-areaversion in the package.json file. - Modified
ThreadPrimitiveRootto useScrollAreaPrimitive.Rootinstead of a primitive div. - Updated
ThreadPrimitiveViewportto utilizeScrollAreaPrimitive.Viewportfor better scroll handling. - Created a new
ScrollBarcomponent that wrapsScrollAreaPrimitive.ScrollAreaScrollbar. - Adjusted CSS styles for the custom scrollbar to ensure proper layout and appearance.
- Updated the lock file to reflect the new dependencies and versions.
- Ensured compatibility with existing components by maintaining the structure of
Thread.RootandThread.Viewport. - Enhanced the overall integration of the scrollbar component within the existing UI framework.
Thank you so much, this is an amazing contribution - I need to do some testing on this before releasing it - will get back to you around Monday!
Thanks! By the way, there don't seem to be any unit/integration tests yet. Is that a decision due to the library's rapidly evolving nature, or is it still being considered? The library is still <1.0.0, so users should expect things to break, but I would be happy to contribute in that area anyway.
@Yonom any updates on when this will be merged? Or is this already implemented with this: https://www.assistant-ui.com/docs/ui/Scrollbar
@PieterT2000 sorry for the delay! we are looking to merge this soon, can you update and resolve conflicts? thanks for your contribution!
Sure, no problem!
We are going to revamp the scroll behavior in an upcoming release. Closing this issue for now