docs(core): declare Chat subcomponent playground scaffolds and tidy progress example#3228
Draft
cixzhang wants to merge 1 commit into
Draft
docs(core): declare Chat subcomponent playground scaffolds and tidy progress example#3228cixzhang wants to merge 1 commit into
cixzhang wants to merge 1 commit into
Conversation
…rogress example Wrap ChatComposer and ChatComposerDrawer previews in a sized Stack so they render at a realistic width (the drawer also seeds default content), and drop the redundant visible value label from the ChatComposerDrawer With Progress example while keeping the accessible label. Refs #2877 (BB-008, BB-009)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Refs #2877 (BB-008, BB-009)— Chat example/playground polish.ChatComposerDrawer — With Progressexample showed a redundant visible "42%" value label in the compact header.ChatComposerandChatComposerDrawerplaygrounds previewed poorly standalone —ChatComposerwas squished at its full-width default, andChatComposerDrawerrendered as a bare, top-rounded fragment with no width/container context.Root cause
BB-008: The example rendered
<ProgressBar value={42} label="Context usage" isLabelHidden hasValueLabel />. InProgressBar.tsxthese two props are orthogonal by design:isLabelHiddenvisually hides the text label (kept for accessibility viaaria-labelledby), whilehasValueLabelindependently surfaces a visible value label (showValueLabel = hasValueLabel && !isIndeterminate). So the value "42%" stayed visible — redundant clutter in the header context. The component is correct (an existing test documents thatisLabelHidden hasValueLabelstill shows the value); this is an example-composition issue.BB-009: PR #2906 added a
playground.wrappermechanism ({component, props?}) so a doc can declare the parent/container its component needs for a realistic preview. It was declared forTab(TabList),SegmentedControlItem(SegmentedControl), andRadioListItem(RadioList) — but not for the Chat subcomponents, so they previewed without sensible width/scaffold.Reproduction (failed → passes)
packages/core/src/ProgressBar/ProgressBar.test.tsx: a new render test using the fixed example's exact props (value={42} label="Context usage" isLabelHidden, nohasValueLabel) asserts no visible "42%" value label renders while the accessible label "Context usage" is present and linked viaaria-labelledby. 23/23 ProgressBar tests pass.apps/docsite/src/__tests__/data-extraction.test.ts: a new test runs the generator and asserts bothChatComposerandChatComposerDrawerresolveplayground.wrapper {component: 'Stack', props: {width: 480}}(and the drawer'splayground.defaults). 74/74 data-extraction tests pass. Codegen proof: regeneratedcomponentRegistry.tsStack-wrapper count for Chat subcomponents went from 0 → 2.Fix
hasValueLabelfromChatComposerDrawerWithProgress.tsx, keeping the accessible label.playground.wrappertoChatComposer.doc.mjsandChatComposerDrawer.doc.mjs, wrapping both inStackatwidth: 480(matching the realistic composer width used in the block example).ChatComposerDraweralso getsplayground.defaults(realisticcount/labelplus Token children) so its collapse-with-badge geometry is demonstrated. No new playground schema invented — the schema supports onlydefaultsandwrapper.Files changed:
ChatComposerDrawerWithProgress.tsx,ChatComposer.doc.mjs,ChatComposerDrawer.doc.mjs,ProgressBar.test.tsx,data-extraction.test.ts, plus a@astryxdesign/core+@astryxdesign/clipatch changeset.Scope — what I did NOT change
isLabelHidden/hasValueLabelare correct as designed; this is purely an example-composition fix.playground.wrapperinjects the previewed component as the wrapper'schildren.ChatComposerrenders itsdrawerslot (notchildren), so a wrapper cannot routeChatComposerDrawerinto the drawer region; the faithful in-schema fix is a sizing/container wrapper so geometry matches real usage. Surfacing the drawer inside a live composer slot would need a mechanism change beyond this docs fix.