Skip to content

feat(docs): interactive story previews for react components#1779

Draft
te6-in wants to merge 11 commits into
devfrom
docs/story
Draft

feat(docs): interactive story previews for react components#1779
te6-in wants to merge 11 commits into
devfrom
docs/story

Conversation

@te6-in

@te6-in te6-in commented Jul 15, 2026

Copy link
Copy Markdown
Member

No description provided.

te6-in and others added 11 commits July 15, 2026 12:47
Replace the static preview ComponentExample with @fumadocs/story
WithControl on the action-button page.

- register the story webpack loader manually; createNextStory passes its
  glob filter straight to webpack `test`, which rejects non-absolute strings
- add a controls filter loader that drops props declared in node_modules,
  mirroring react-type-table's filtering
- add withStoryPreview to wrap stories with the ComponentExample canvas and
  redeclare call-site props (e.g. children) so they survive the filter
- bump fumadocs-core/ui to 16.11.3 (story peer requires ^16.10) with
  follow-up fixes: blog publishedAt schema (js-yaml 5 parses timestamps as
  strings), tailwindcss 4.3 (fumadocs-ui uses inset-s utilities), and
  shiki 4 (rehypeCode option types)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
FieldSet already supports `collapsible`, but WithControl hardcodes the
call without it — pass `collapsible: false` so the props panel starts
open. Worth upstreaming as a defineStory option.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy the story render subtree (WithControl, arg-form FieldSet, select, input, defineStoryFactory) into docs/components/story so the Story UI can be customized directly instead of patching the package. lib/story.ts now uses the vendored factory, routing all story pages through the owned render layer. type-tree and the webpack story loader stay on the published package; the loader still injects _generated because it detects stories by the defineStory call name, not import source.

Bake collapsible: false into the vendored FieldSet call and drop the now-unused @fumadocs/story@1.2.0 patch that set it on the package's WithControl.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oader

The controls filter drops props declared only in node_modules, which
includes React's `children`. Special-case `children` so it survives and
renders as a string control (via ReplaceReactNode), removing the need for
a per-story withStoryPreview<{ children?: string }>() override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert the hero preview of each non-deprecated react component doc from
the static ComponentExample to an @fumadocs/story interactive preview.

- add preview.story.tsx for every remaining component and wire each MDX
  hero to <Preview />; preview.tsx is kept (still used by Examples sections)
- drop the withStoryPreview<{ children?: string }>() overrides from
  badge/text/action-button (children now surfaces via the filter loader)
- drop dead children controls on progress-circle/identity-placeholder via
  children?: never (they type but never render children)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Import the type-tree runtime helpers from the client-safe sampler/stringify/validator submodules instead of the barrel, whose builder.js re-export drags ts-morph (a Node-only compiler using node: builtins) into the browser bundle and breaks `next build` with output: export. Patch @fumadocs/story to expose those submodule subpaths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Snackbar reads useSnackbarContext, so the statically-rendered preview needs a SnackbarProvider ancestor; without it the static export prerender of /react/components/snackbar throws.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the hand-written control interfaces with the components' real prop types (ComponentPropsWithoutRef / withStoryPreview<Extra> extra-key validation) so the controls panel drives actual props, drop the now-unused displayName, and split the select-box preview into Check and Radio panels.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The controls filter loader now reads each surviving prop's `@default`
JSDoc tag (SEED recipe types tag their variants) and emits a `defaults`
map into `_generated`. The story factory merges it under `initial` with
precedence component @default < story initial < fixed, so a Chip Radio or
Switch preselects the component's real default instead of the first
member/off state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a shared `icon-set` (mirrored fill/line sets keyed by icon component
name) so story icon slots become a Chip Radio picker: arg-form detects an
icon enum when every member resolves to a known icon, rendering the real
glyph as a prefix with a prettified label, plus an "Unset" chip for
optional slots via the NO_ICON sentinel. Rewire the FAB, list,
swipeable-menu-sheet, and tag-group previews onto it.

Also treat SEED boolean props (`true | false` literal enums) as a Switch,
wrap the enum/variant chip rows in ScrollFog so they scroll horizontally
instead of wrapping, swap the field unset control to an ActionButton, and
drop the unused JsonInput.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3f4c946

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 928fc894-9267-40d7-ac39-75f35a739eaf

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/story

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Alpha Preview (Storybook)

@github-actions

Copy link
Copy Markdown
Contributor

Alpha Preview (Stackflow SPA)

@github-actions

Copy link
Copy Markdown
Contributor

Alpha Preview (Docs)

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