Skip to content

Create ControlledCheckbox Storybook Stories#84

Closed
codegen-sh[bot] wants to merge 2 commits into
codegen/lc-240-medusa-forms-controlled-components-documentation-stories-andfrom
codegen/lc-243-create-controlledcheckbox-storybook-stories
Closed

Create ControlledCheckbox Storybook Stories#84
codegen-sh[bot] wants to merge 2 commits into
codegen/lc-240-medusa-forms-controlled-components-documentation-stories-andfrom
codegen/lc-243-create-controlledcheckbox-storybook-stories

Conversation

@codegen-sh
Copy link
Copy Markdown
Contributor

@codegen-sh codegen-sh Bot commented May 31, 2025

Overview

This PR implements comprehensive Storybook stories for the ControlledCheckbox component as part of the Medusa Forms controlled components documentation effort.

Changes Made

📚 Storybook Stories

  • Created: apps/docs/src/medusa-forms/ControlledCheckbox.stories.tsx
  • 8 Story Variants:
    1. Basic Usage - Simple checkbox with react-hook-form integration
    2. Default Checked State - Pre-checked checkbox
    3. Default Unchecked State - Unchecked by default
    4. Required Validation - Required field validation
    5. Custom Validation Message - Custom validation messages
    6. Error State Display - Error state demonstration
    7. Disabled State - Disabled checkbox functionality
    8. Multiple Checkboxes - Advanced example with select-all functionality
    9. Complete Form Example - Real-world form integration

🔧 Package Structure Improvements

  • Created missing index files:
    • packages/medusa-forms/src/index.ts
    • packages/medusa-forms/src/controlled/index.ts
    • packages/medusa-forms/src/ui/index.ts
    • packages/medusa-forms/src/remix/index.ts
  • Fixed module exports and build configuration
  • Resolved build issues with proper component exports

Implementation Details

✅ Follows Requirements

  • ✅ Uses react-hook-form directly with FormProvider and useForm
  • NO react-router-stub dependencies
  • ✅ Follows pattern established in ControlledInput.stories.tsx
  • ✅ All 4 required story variants implemented
  • ✅ Multiple states covered (basic, validation, error, disabled)
  • ✅ Boolean value handling properly demonstrated
  • ✅ Stories are well-documented with appropriate args and controls

🎯 Story Features

  • Form Integration: Each story uses proper react-hook-form setup
  • Validation Examples: Required fields, custom messages, error states
  • State Management: Controlled state with proper boolean handling
  • Advanced Examples: Multiple checkboxes with select-all functionality
  • Real-world Usage: Complete form integration example

🏗️ Build Configuration

  • Fixed package exports for proper module resolution
  • Added missing barrel files for clean imports
  • Resolved build errors with correct component exports
  • Generated type declarations for TypeScript support

Testing

  • ✅ Package builds successfully with npm run build
  • ✅ All exports properly configured
  • ✅ Type declarations generated
  • ✅ Stories follow established patterns

Files Modified

  • apps/docs/src/medusa-forms/ControlledCheckbox.stories.tsx (new)
  • packages/medusa-forms/src/index.ts (new)
  • packages/medusa-forms/src/controlled/index.ts (new)
  • packages/medusa-forms/src/ui/index.ts (new)
  • packages/medusa-forms/src/remix/index.ts (new)

Next Steps

  1. Test stories in Storybook environment
  2. Verify all variants work as expected
  3. Review documentation and examples

Closes LC-243


💻 View my workAbout Codegen

- Add comprehensive ControlledCheckbox.stories.tsx with 8 story variants
- Include basic usage, validation states, disabled state, and form integration examples
- Create missing index.ts files for proper module exports
- Add controlled/index.ts, ui/index.ts, remix/index.ts, and src/index.ts
- Fix package build configuration and exports
- Stories demonstrate react-hook-form integration without react-router dependencies
- Cover all required acceptance criteria: basic usage, validation, error states, disabled states
- Include advanced examples like multiple checkboxes with select-all functionality
- Add complete form integration example showing real-world usage patterns
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Join our Discord community for assistance with any issues or questions.

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 sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@codegen-sh
Copy link
Copy Markdown
Contributor Author

codegen-sh Bot commented May 31, 2025

I see a check failed - I'm on it! 🫡

💻 View my work

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codegen-sh let's remove this barrel file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codegen-sh let's remove this barrel file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codegen-sh let's remove this barrel file

@codegen-sh
Copy link
Copy Markdown
Contributor Author

codegen-sh Bot commented May 31, 2025

I'll work on removing the barrel file! 🗑️

💻 View my work

@jaruesink jaruesink closed this May 31, 2025
@codegen-sh
Copy link
Copy Markdown
Contributor Author

codegen-sh Bot commented May 31, 2025

Barrel files removed as requested!

I've successfully removed all the barrel files you mentioned:

🗑️ Files Removed:

  • packages/medusa-forms/src/index.ts
  • packages/medusa-forms/src/ui/index.ts
  • packages/medusa-forms/src/remix/index.ts (and entire remix directory)

🔧 Updates Made:

  • Updated vite.config.ts to only build controlled components entry point
  • Updated import in ControlledCheckbox.stories.tsx to use direct import path:
    import { ControlledCheckbox } from '@lambdacurry/medusa-forms/controlled/ControlledCheckbox';

✅ Verification:

  • Build still works correctly (npm run build passes)
  • All components are properly exported from their individual files
  • Stories should work with the direct import path

The package now has a simpler export structure without barrel files! 🎉

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