docs(components): standardize component reference docs, stories, and API JSDoc - #6526
Conversation
|
|
📦 1 of 5 PRs splitting the oversized
🔀 Cross-surface note: this PR establishes the sentence-case heading convention and the anatomy/options/states/behaviors section model for component + internal genres. Patterns and controllers (#6528) are not yet audited to the same standard. |
…API JSDoc Normalizes the per-component reference documentation for 2nd-gen components: - Consistent anatomy / options / states / behaviors sections across components - Sentence-case headings and meta names; removed duplicated content - Standardized static-color patterns - Documented previously-undocumented API in component source JSDoc (Badge, Button, IllustratedMessage, StatusLight, Tab, Tabs) - Sentence-cased story/test names to match Part of splitting the large docs-site-updates branch (SWC-2379). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b849b95 to
33892c4
Compare
| This style reduces visual weight while maintaining semantic meaning. | ||
|
|
||
| > **Important**: The outline style is only valid for semantic variants (`accent`, `informative`, `neutral`, `positive`, `notice`, `negative`). | ||
| > ⚠️ **Important:** The `outline` style is only valid for semantic variants (`accent`, `informative`, `neutral`, `positive`, `notice`, `negative`). |
There was a problem hiding this comment.
We'll probably want a follow-up ticket to look into changing these into the inline-style alerts/callouts that you see in the migration guides (under Styling).
See also #6525 (comment), I'll keep this thread open until there's a ticket for this.
There was a problem hiding this comment.
SWC-2385 is the ticket!
There was a problem hiding this comment.
This one needs an mdx file (which is why a few things are off here), noted and ticket made: SWC-2382
…ctions These two sections (plus the AdaptiveContrast story) were removed from color-loupe in the "make anatomy sections consistent" pass, but they document real, shipping behavior (the white-first adaptive inner-border contrast for WCAG 1.4.11, implemented in ColorLoupe.base.ts) and were not duplicated elsewhere — color-handle keeps its equivalent sections. Restoring them to match color-handle and origin/main; the removal was out of scope for that pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| The inner-border opacity is computed from the current `color`: it holds a floor of 12% whenever the white outer border already carries 3:1, and climbs only where white cannot. The surrounding color is approximated by the loupe's own `color`, which is accurate on smooth gradients and approximate at steep or saturated edges. | ||
|
|
||
| <Canvas of={ColorLoupeStories.AdaptiveContrast} /> | ||
|
|
There was a problem hiding this comment.
I wasn't sure why these were removed in the previous commit, but if someone else has an idea about why, I'm happy to hear it! 😅
📚 Branch Preview Links🔍 Gen1 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
| }, | ||
| }; | ||
|
|
||
| export const Orientation: Story = { |
There was a problem hiding this comment.
Adding this story so it should show up as new in Chromatic, and you'll see that the story is used in the mdx docs.
I did this because a lot of content under the old ### Vertical heading and ### Layout Orientation heading before was duplicative. So they were combined into an ### Orientation heading with an orientation story to match that shows both vertical and horizontal orientations.
| `, | ||
| parameters: { | ||
| flexLayout: 'column-center', | ||
| chromatic: { disableSnapshot: true }, |
There was a problem hiding this comment.
This story is used for testing only now, if you look in the mdx file, ### Orientation with corresponding story has replaced ### Vertical and its story.
There was a problem hiding this comment.
There's a ticket to add an accessibility section to typography.mdx: SWC-2380
| ### Quiet | ||
|
|
||
| The `quiet` variant removes the item divider borders and rounds the header corners on hover and focus. | ||
| The `quiet` variant removes the item divider borders and rounds the header corners on hover. |
There was a problem hiding this comment.
In the css, it says:
/* Quiet: removes dividers and rounds header corners (visible on hover and focus) */
:host([quiet]) ::slotted(swc-accordion-item) {
--swc-accordion-item-divider-color: transparent;
--swc-accordion-item-header-corner-radius: var(--_swc-accordion-corner-radius);
}We should bring back the and focus here (?)
There was a problem hiding this comment.
Yes, they are rounded as well, but I think this one I opted to take out because focus visible corners are always rounded (for every variant, but also for almost all components), so I didn't want it to sound like the rounded corners for focus were quiet-specific.
There was a problem hiding this comment.
Most component stories don't have this parameter of section-order. Button group and link have this. Do we still need this parameter?
There was a problem hiding this comment.
Ooh good catch, we do not need it.
I wonder if we should take it out of our rules? It kind of feels like rules could use a bigger audit than just removing rules around section-order though.
There was a problem hiding this comment.
I agree - I'm not sure if section-order needs a rule set for now
|
|
||
| Non-semantic variants use color-coded categories, ideal for data visualization and labeling. Best used when there are **8 or fewer** categories being color coded. | ||
|
|
||
| > **Note**: The `pink`, `turquoise`, `brown`, `cinnamon`, and `silver` variants are new in 2nd-gen and not available in 1st-gen. |
There was a problem hiding this comment.
Claude had originally made an item for a follow-up ticket so that we remove 1st-gen references/comparisons from our Docs (.mdx) pages and anything in .ts file comments and only leave them in the migration guides, I think in some ways that separation makes sense (so that when the time comes where Spectrum 1 is gone, we don't need to make corrections to our code other than removing migration guides), but I can also see how notes like this are helpful on the main docs page.
I didn't end up making the ticket, but am open to opinions if we think it would be valuable to do so.
…est titles Follow-up from PR #6526 review: writes down the conventions the PR established but didn't document, and removes the meta.title/test-title duplication that made the Storybook sentence-case rename fragile. - stories-documentation.md: replace the two-tier visual/technical Anatomy pattern with the flattened bullet-list pattern actually used in this PR - text-formatting.md: document the warning-emoji convention for consequential Important callouts - stories-format.md: add a states-vs-behaviors test for story tagging - derive `${meta.title}/Tests` instead of re-literaling the title in the five .test.ts files this PR touched Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ng literals
Storybook's story indexer statically parses `title` via AST without
executing the module ("CSF: unexpected dynamic title"), so
`` `${meta.title}/Tests` `` broke the Storybook build (and everything
downstream of it: the browser test suites and Chromatic) in the five
files touched by the previous commit.
Revert to literal title strings in these files; the meta.title/test-title
duplication stands as a known fragility, not one fixable with a template
literal.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Correction to my earlier review comment: the suggestion to derive |
Coverage Report for CI Build 29815384104Coverage increased (+0.002%) to 96.243%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Merging main brought in button-custom-properties.vrt.ts (added by PR #6463 after this branch diverged), which enforces that every @cssprop documented on Button.ts has a matching visual test row. This docs PR documented --swc-button-down-state-transform (and --swc-button-max-inline-size, already covered) in Button.ts's JSDoc without a corresponding row, which failed the coverage check on the PR/main merge build ("Button VRT: Custom Properties"). Add the missing row, forcing the active state and overriding to a visually obvious rotate() so the reference/override pair shows a real difference. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
There are actually changes to all of these rules (stories-documentation, stories-format, and text-formatting) in #6529, which is meant to capture rule changes we found we needed to make across the whole series of PRs (not just components) and establishes a lint rule, could we add any of these changes if they're necessary to that PR instead?
Anatomy/callout/tag convention updates to stories-documentation.md, stories-format.md, and text-formatting.md belong with the other .ai/rules standardization work landing in #6529, not this docs-content PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Description
Standardizes the 2nd-gen component reference docs, stories, and API JSDoc. This includes everything under
components/except the migration guides (48 files: 19 reference.mdx, 18stories/*.ts, 6 component source.tsJSDoc, 5 tests):Changes to
.tsfiles are JSDoc/comment and story/test-name only; no runtime or behavior changes.Motivation and context
This is 1 of 5 PRs splitting the oversized
rise-erpelding/docs-site-small-updatesbranch (112 files) into reviewable pieces, divided by documentation surface. The original single PR was too large for GitHub and human reviewers to handle. Splitting by surface keeps each review scoped; the cross-surface consistency observations that a directory-based split would otherwise hide are preserved in the "Consistency notes" section below.The five PRs together reproduce the original change set exactly (18 + 48 + 20 + 22 + 4 = 112 files, disjoint).
Merge order
Merge this before #6529. That PR adds a
.husky/pre-commitrule enforcing sentence-case headings for component + internal genres; it will trip the hook against these docs until they are onmain. No ordering constraint relative to the other content PRs.Consistency notes
Related issue(s)
Screenshots (if appropriate)
N/A (documentation only)
Author's checklist
Manual review test cases
Documentation-only; no runtime or behavior changes to verify. Review is mixed:
.mdxreference docs and stories..tsJSDoc additions.Device review / Accessibility testing
N/A (no rendered component behavior changes)