Skip to content

BAH-4747 | [Storybook]: Consistent update for composite controls#55

Open
komalsharma225 wants to merge 4 commits into
masterfrom
feature/BAH-4747
Open

BAH-4747 | [Storybook]: Consistent update for composite controls#55
komalsharma225 wants to merge 4 commits into
masterfrom
feature/BAH-4747

Conversation

@komalsharma225

@komalsharma225 komalsharma225 commented Jun 5, 2026

Copy link
Copy Markdown

Summary

Enhance Storybook documentation for control stories by adding professional, auto-generated documentation following the Carbon Design System pattern. Stories now include comprehensive prop descriptions, type information, and usage guidance.

Changes

New Files

  • stories/_meta/ — 5 reusable metadata files with descriptions and argTypes:
    • obsControlMeta.js — ObsControl documentation and prop definitions
    • abnormalObsControlMeta.js — AbnormalObsControl documentation
    • sectionMeta.js — Section documentation
    • multiSelectMeta.js — MultiSelect documentation
    • formsMeta.js — Forms documentation

Modified Files

  • .storybook/main.js — Added MDX file support (../stories/**/*.mdx)
  • stories/StoryWrapper.js — Added optional showDebug prop (defaults to false) for clean default views with optional debug variants
  • stories/ObsControl.stories.js — Imported metadata, added tags: ['autodocs'] for auto-generated docs
  • stories/AbnormalObsControl.stories.js — Imported metadata, added autodocs support, added component: reference
  • stories/Section.stories.js — Imported metadata, added autodocs support, removed unused React import
  • stories/MultiSelect.stories.js — Imported metadata, added autodocs support, added component: reference
  • stories/Forms.stories.js — Imported metadata, added autodocs support, added component: reference

Acceptance Criteria Met

Technical Details

Metadata Pattern

Each _meta/*.js file exports:

export const description = '...'; // Markdown string explaining control purpose, usage, examples
export const argTypes = { ... }; // Storybook argTypes format with descriptions

Story Wiring

Each story file imports metadata:

import { description, argTypes } from './_meta/controlMeta';

export default {
  title: 'Complex Controls/ControlName',
  component: ControlComponent,
  tags: ['autodocs'],
  argTypes,
  parameters: {
    docs: {
      description: { component: description },
    },
  },
};

Backward Compatibility

  • StoryWrapper changes are fully backward compatible (default showDebug: false)
  • Existing stories continue to render without modification
  • New WithDebugView variants are optional additions

Testing

  • ✅ Storybook builds successfully with all 5 updated stories
  • ✅ Docs tabs auto-generate correctly with imported descriptions and argTypes
  • ✅ Stories render without errors
  • ✅ No console warnings related to missing props or metadata
  • ✅ Clean default view works (no JSON tree by default)

Visual Improvements

Before: Basic stories with minimal documentation
After: Professional, auto-generated docs with complete prop tables and usage guidance (Carbon Design System style)

- Wire metadata (description + argTypes) to ObsControl, AbnormalObsControl, Section, MultiSelect, Forms stories
- Add tags: ['autodocs'] for auto-generated professional documentation (Carbon Design System style)
- Refactor StoryWrapper with optional showDebug prop (default false) for clean views
- Add MDX support to Storybook config
- Create _meta/*.js files with reusable control metadata and prop descriptions
- Remove unused React import in Section.stories.js

AC met: #2 (descriptions), #3 (argTypes), #4 (autodocs), #5 (clean default), #7 (all 5 controls)
Note: AC #1 (sidebar rename to "Composite Controls") skipped per user direction to keep "Complex Controls"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@komalsharma225 komalsharma225 changed the title BAH-4747 | Add autodocs and metadata wiring to composite control stories BAH-4747 | [Storybook]: Consistent update for composite controls Jun 5, 2026
komalsharma225 and others added 3 commits June 5, 2026 11:24
Exclude @carbon packages from transformIgnorePatterns so Jest doesn't attempt
to parse their CSS imports. This resolves test failures introduced when
@carbon/react, @carbon/icons-react, and @carbon/layout were added to
devDependencies for BAH-4747.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add explicit moduleNameMapper for @carbon/styles CSS files to resolve them as identity-obj-proxy
- Remove @carbon from transformIgnorePatterns since it should not be transformed
- Carbon packages are pre-built and should be ignored during transformation
- This allows @bahmni/design-system (which is transformed) to properly import CSS from @carbon/styles

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Required for Jest moduleNameMapper to properly mock CSS imports.
This package creates a proxy object for CSS modules during testing.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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