Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Radio Group #973

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Add Radio Group #973

merged 2 commits into from
Jan 14, 2025

Conversation

tszhong0411
Copy link
Owner

@tszhong0411 tszhong0411 commented Jan 13, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Radio Group component to the UI package
    • Allows selecting one option from a predefined set of choices
  • Documentation

    • Added comprehensive documentation for Radio Group component
    • Included usage examples and implementation details
  • Dependencies

    • Added @radix-ui/react-radio-group library to support the new component

The Radio Group component enhances the user interface by providing a clean, accessible way to make single selections.

Copy link

changeset-bot bot commented Jan 13, 2025

🦋 Changeset detected

Latest commit: a5ad235

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tszhong0411/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2025 10:30pm
honghongme ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2025 10:30pm

Copy link

linear bot commented Jan 13, 2025

PACK-32 Add Radio Group

Copy link

coderabbitai bot commented Jan 13, 2025

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/docs/src/components/demos/radio-group/radio-group.tsx

Oops! Something went wrong! :(

ESLint: 9.17.0

Error: Cannot find package '/node_modules/@tszhong0411/eslint-config/dist/index.js' imported from /eslint.config.mjs
at legacyMainResolve (node:internal/modules/esm/resolve:207:26)
at packageResolve (node:internal/modules/esm/resolve:826:14)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

Walkthrough

A new Radio Group component has been introduced to the @tszhong0411/ui package, enabling users to select a single option from a predefined set of choices. The implementation leverages Radix UI's radio group primitives and includes documentation, a demo component, and necessary package configurations. The addition expands the UI component library with an accessible and customizable radio button interface.

Changes

File Change Summary
.changeset/twenty-baboons-protect.md Added patch for new Radio Group component
apps/docs/src/app/ui/components/radio-group.mdx New documentation file for Radio Group component
apps/docs/src/components/demos/radio-group/radio-group.tsx Added RadioGroupDemo component with three radio button options
apps/docs/src/config/links.ts Added link to Radio Group component documentation
packages/ui/package.json Added @radix-ui/react-radio-group dependency
packages/ui/src/index.ts Added export for radio group module
packages/ui/src/radio-group.tsx Implemented RadioGroup and RadioGroupItem components

Sequence Diagram

sequenceDiagram
    participant User
    participant RadioGroup
    participant RadioGroupItem

    User->>RadioGroup: Select Radio Group
    RadioGroup->>RadioGroupItem: Manage Selection
    RadioGroupItem-->>RadioGroup: Update Selected Item
    RadioGroup-->>User: Display Selected Option
Loading

Poem

🐰 Hop, hop, radio buttons bright,
Choices dancing left and right!
One selection, crisp and clear,
A UI component we hold dear.
Radix magic, rabbit's delight! 🎉

Finishing Touches

  • 📝 Generate Docstrings (Beta)

🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/ui/src/radio-group.tsx (1)

20-34: Consider enhancing keyboard focus styles.

While the focus styles are implemented, consider adding a darker ring color for better contrast in dark mode.

-        'focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2',
+        'focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 dark:focus-visible:ring-gray-400',
apps/docs/src/components/demos/radio-group/radio-group.tsx (1)

5-18: Add accessibility improvements and event handling demo.

Consider these enhancements to make the demo more comprehensive:

  1. Add aria-label to the RadioGroup for better accessibility
  2. Include an onChange handler to demonstrate state management
-    <RadioGroup defaultValue='comfortable'>
+    <RadioGroup
+      defaultValue='comfortable'
+      aria-label='View density'
+      onValueChange={(value) => console.log('Selected:', value)}
+    >
.changeset/twenty-baboons-protect.md (1)

1-5: Enhance the changeset description for better changelog clarity.

While the patch version bump is appropriate, consider expanding the description to include:

  • Brief overview of the component's purpose
  • Key features (e.g., accessibility, customization)
  • Dependencies added (Radix UI integration)
 ---
 '@tszhong0411/ui': patch
 ---
 
-Add Radio Group
+Add Radio Group component
+
+- Introduces a new accessible Radio Group component using Radix UI primitives
+- Enables single selection from predefined choices
+- Includes customization options and keyboard navigation support
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c94b1d and 941fd16.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/twenty-baboons-protect.md (1 hunks)
  • apps/docs/src/app/ui/components/radio-group.mdx (1 hunks)
  • apps/docs/src/components/demos/radio-group/radio-group.tsx (1 hunks)
  • apps/docs/src/config/links.ts (1 hunks)
  • packages/ui/package.json (1 hunks)
  • packages/ui/src/index.ts (1 hunks)
  • packages/ui/src/radio-group.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/docs/src/app/ui/components/radio-group.mdx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: TypeScript
  • GitHub Check: Knip
  • GitHub Check: Spelling
  • GitHub Check: ESLint
🔇 Additional comments (5)
packages/ui/src/radio-group.tsx (1)

7-13: LGTM! Well-structured RadioGroup component.

The implementation properly extends Radix UI's RadioGroup primitive while maintaining type safety and allowing for customization through className props.

packages/ui/src/index.ts (1)

34-34: LGTM! Proper export configuration.

The radio-group export is correctly added and maintains alphabetical ordering.

apps/docs/src/config/links.ts (1)

145-148: LGTM! Proper navigation configuration.

The Radio Group component link is correctly added with consistent formatting and proper alphabetical placement.

packages/ui/package.json (2)

48-48: LGTM! Radix UI dependency addition looks good.

The @radix-ui/react-radio-group dependency follows the same versioning pattern as other Radix UI components in the package.


Line range hint 71-74: Verify React and Next.js version compatibility.

The peer dependencies specify unreleased versions:

  • react: "^19" (current stable is 18.x)
  • next: "^15" (current stable is 14.x)

Please verify if these are intentional or need to be adjusted to current stable versions.

✅ Verification successful

These version requirements are intentional and documented

The changelog shows these are deliberate upgrades made through multiple PRs:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if these versions are mentioned in other workspace packages
echo "Checking React version usage across workspace:"
fd -e json package.json -x jq -r 'select(.peerDependencies != null) | select(.peerDependencies.react != null) | .name + ": " + .peerDependencies.react'

echo -e "\nChecking Next.js version usage across workspace:"
fd -e json package.json -x jq -r 'select(.peerDependencies != null) | select(.peerDependencies.next != null) | .name + ": " + .peerDependencies.next'

Length of output: 586


Script:

#!/bin/bash
# Check root package.json dependencies
echo "Root package.json dependencies:"
jq -r '.dependencies // {} | with_entries(select(.key | test("react|next")))' package.json
echo -e "\nRoot package.json devDependencies:"
jq -r '.devDependencies // {} | with_entries(select(.key | test("react|next")))' package.json

# Check actual dependencies in ui package
echo -e "\nUI package dependencies:"
jq -r '.dependencies // {} | with_entries(select(.key | test("react|next")))' packages/ui/package.json
echo -e "\nUI package devDependencies:"
jq -r '.devDependencies // {} | with_entries(select(.key | test("react|next")))' packages/ui/package.json

# Look for documentation about versions
echo -e "\nChecking for version-related documentation:"
fd -e md -x grep -l -i "react.*19\|next.*15" {} \;

Length of output: 2381


Script:

#!/bin/bash
# Check changelog entries for version updates
echo "UI Package Changelog entries:"
grep -A 5 -B 5 "react.*19\|next.*15" packages/ui/CHANGELOG.md

echo -e "\nREADME mentions:"
grep -A 5 -B 5 "react.*19\|next.*15" README.md

echo -e "\nPackage versions in workspace:"
fd -e json package.json -x jq -r 'select(.version != null) | .name + ": v" + .version'

Length of output: 3979

@tszhong0411 tszhong0411 merged commit 66ea167 into main Jan 14, 2025
11 checks passed
@tszhong0411 tszhong0411 deleted the pack-32-add-radio-group branch January 17, 2025 15:21
@coderabbitai coderabbitai bot mentioned this pull request Jan 19, 2025
This was referenced Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant