Skip to content

Componentry: Migrate Chip to @wordpress/ui Badge - #48162

Merged
CGastrell merged 6 commits into
trunkfrom
update/components-chip-use-wp-ui
Apr 27, 2026
Merged

CGastrell merged 6 commits into
trunkfrom
update/components-chip-use-wp-ui

Conversation

@nerrad

@nerrad nerrad commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Part of #48160.

Proposed changes

Chip → Badge

  • Replace the internal Jetpack Chip component (from @automattic/jetpack-components) with Badge from @wordpress/ui.
    • _inc/client/writing/composing.jsx — "New" tag on the AI Assistant learn-more link. Wrapped in <Stack align="center" gap="sm"> to restore the 8px horizontal gap the old Chip SCSS provided.
    • _inc/client/newsletter/email-settings.jsx — the old Chip is removed entirely with no Badge replacement. This FormLegend is inside the legacy Newsletter settings tab which is slated for removal (new dashboard at page=jetpack-newsletter via @jetpack/newsletter is the default now via jetpack_wp_admin_newsletter_settings_enabled).
  • Map the legacy type="new" prop to intent="stable" — matches the mapping established in Components: Migrate Badge to @wordpress/ui #48156 (success → stable) and renders the same green "positive" pill as the old .is-new chip.
  • Delete the now-unused internal Chip component, its SCSS module, stories, README, and barrel export from @automattic/jetpack-components.

Custom "New"-pill migration (same semantic, sibling of Chip)

  • plugins/jetpack Recommendations — replace the custom .jp-recommendations__new-badge span in the three consumers (feature-summary/index.jsx, feature-summary/resource.jsx, prompts/prompt-layout/index.jsx) with <Badge intent="stable">. Drop the pill-styling block from recommendations/style.scss and replace the .jp-recommendations__new-badge { margin-*: 1rem } descendant rules in feature-summary/style.scss and prompts/prompt-layout/style.scss with gap: 1rem on the (already-flex) parents.
  • packages/my-jetpack AI product interstitial — drop the orphaned .product-interstitial__new-badge SCSS block. The JSX that used it was removed in the Write Brief (Breve) removal commit, leaving this CSS unused.

@wordpress/ui@0.11.0 is already a dependency of plugins/jetpack, no new dependency added.

Related product discussion/links

  • phcsdm-PK-p2

Does this pull request change what data or activity we track or use?

No.

Screenshots

Captured on a live Jurassic Tube site at 1440×900 via the jetpack-screenshot skill.

Writing → Composing — "Learn more about all Jetpack AI features" New badge

Before (Jetpack Chip) After (@wordpress/ui Badge intent="stable" in Stack gap="sm")
before after

Recommendations summary — feature-summary New badges

Before (custom .jp-recommendations__new-badge span) After (@wordpress/ui Badge intent="stable", parent flex gap: 1rem)
before after

Note

The Recommendations screenshots were taken with a temporary local patch that forced isNew to true in the three consumers (feature-summary/index.jsx, feature-summary/resource.jsx, prompts/prompt-layout/index.jsx) so the badge would render unconditionally. The patch was reverted before pushing — this branch ships only the real isNew gated behavior. In production, only features actually flagged as "new" in recommendations data will render the badge.

Testing instructions

  1. Build Jetpack: jp build plugins/jetpack.
  2. Open wp-admin/admin.php?page=jetpack#/writing on a site that has Jetpack connected.
  3. Scroll to Composing — when Jetpack Blocks is on and My Jetpack is reachable, the "Learn more about all Jetpack AI features" link shows a New badge at the end. It should render as a small green pill with ~8px horizontal gap from the link.
  4. (Optional) In wp-admin/admin.php?page=jetpack#/recommendations, navigate to any step where a feature is flagged as new (requires specific server state). The New badge should render as a green pill adjacent to the feature display name or progress bar with ~1rem gap.
  5. Confirm no regressions elsewhere — the old Chip export is removed from @automattic/jetpack-components; the .jp-recommendations__new-badge and .product-interstitial__new-badge CSS classes are removed.

@github-actions

github-actions Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/components-chip-use-wp-ui branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/components-chip-use-wp-ui
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/components-chip-use-wp-ui

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [JS Package] Components [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Admin Page React-powered dashboard under the Jetpack menu Docs RNA labels Apr 18, 2026
@github-actions

github-actions Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: May 5, 2026
    • Code freeze: May 4, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Apr 18, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@nerrad
nerrad force-pushed the update/components-chip-use-wp-ui branch from 07543f2 to 0a1db35 Compare April 18, 2026 19:34
@nerrad
nerrad force-pushed the update/components-chip-use-wp-ui branch from 04317eb to e06cc91 Compare April 18, 2026 20:04
@nerrad
nerrad marked this pull request as ready for review April 19, 2026 11:16

@nerrad nerrad left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Self-review (by agent orchestrator) after a dual-reviewer pass (Claude team + codex CLI). Inline comments below cover the must-fix items (changelog significance on a public-export removal; RadioControl rebase conflict) and one should-fix item (semantic intent).

Edit: live verification on a Jurassic Ninja site confirmed the Badge renders correctly on the Composing page (green pill, 8px gap). Dropped the prior design-tokens.css bundle concern — Badge's compiled CSS has hex fallbacks baked in, so tokens are non-blocking.

*left by Biff (executive assistant agent) on behalf of Darren

{ __( 'Learn more about all Jetpack AI features', 'jetpack' ) }
</a>
{ /* TODO: remove this Badge once it's no longer "new" */ }
<Badge intent="stable">{ __( 'New', 'jetpack' ) }</Badge>

@nerrad nerrad Apr 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic mismatch: intent="stable" means "healthy/unchanged" per @wordpress/ui types — chosen here because it paints green, not because it's semantically correct for a "New" label. informational (blue) or draft (neutral) are the semantically honest choices. Worth a design call rather than codifying the color-match.

*left by Biff (executive assistant agent) on behalf of Darren

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ilonagl - what do you think about this agent review finding? I kinda agree, but semantics aside we probably still want to keep the green coloring for this purpose?

@nerrad
nerrad requested a review from a team April 19, 2026 19:49
@nerrad
nerrad force-pushed the update/components-chip-use-wp-ui branch from f503462 to 5b24e59 Compare April 19, 2026 20:04
@CGastrell

Copy link
Copy Markdown
Contributor

Small nit from a read-through — @wordpress/ui@0.11.0's Badge has no success intent (valid values per packages/ui/src/badge/types.ts in gutenberg: high | medium | low | stable | informational | draft | none). The call sites are already correct after 3addf04, but the changelog, README, and @deprecated JSDoc still pointed consumers at intent="success" — which would trip up anyone migrating their own Chip usage via the IDE hint.

Pushed a tiny follow-up swapping success → stable in those three spots: b137407f24f2d09656bb2b9e82308b16af68d7ea. Feel free to squash or drop if you'd rather roll it into your own commit — happy either way.

nerrad and others added 6 commits April 24, 2026 13:06
Part of #48160.

Replace the internal Jetpack `Chip` component (from
`@automattic/jetpack-components`) with `Badge` from `@wordpress/ui` in the
two consumers found in `plugins/jetpack` (`writing/composing.jsx` and
`newsletter/email-settings.jsx`). Map the legacy `type="new"` to
`intent="success"` — matches the existing green "new" styling.

Delete the now-unused internal Chip component, its SCSS module, stories,
README, and barrel export from `@automattic/jetpack-components`.
`intent="success"` is not a valid @wordpress/ui Badge intent
(valid: high | medium | low | stable | informational | draft | none)
and produces the missing CSS class `is-success-intent`, which leaves
the badge unstyled. Switch to `stable`, which renders the green
"positive" pill matching the previous Chip's green "new" styling and
aligns with the mapping established in #48156.
- composing.jsx: wrap link + Badge in `@wordpress/ui` Stack with
  `gap="sm"` (8px design token) to restore the 8px margin the old Chip
  SCSS carried.
- email-settings.jsx: drop the Chip entirely (no Badge replacement).
  This FormLegend is inside the legacy Newsletter settings tab which
  is slated for removal; no point wiring new UI into code on its way
  out.
…l new-badge

- Recommendations: replace custom `jp-recommendations__new-badge` span in
  the three consumers (feature-summary index + resource, prompt-layout)
  with `@wordpress/ui` Badge (`intent="stable"`). Drop the pill-styling
  block from `recommendations/style.scss` and the scoped `margin-*: 1rem`
  descendant rules in feature-summary and prompt-layout stylesheets;
  replace them with `gap: 1rem` on the already-flex parents.
- My Jetpack AI interstitial: drop the orphaned
  `.product-interstitial__new-badge` SCSS block. The JSX that used it
  was removed in the Write Brief (Breve) removal commit, leaving this
  CSS unused.
@automattic/jetpack-components is published to npm as a public package,
so removing the Chip named export under Significance: patch would break
downstream consumers pinned to ^1.8.x on a normal semver-compatible
upgrade.

Restore the original Chip implementation, README, and barrel export, and
mark them @deprecated pointing at Badge from @wordpress/ui (mapping
type="new" to intent="success"). Bump the changelog entry to
Significance: minor / Type: deprecated to reflect the actual API change.

The internal consumers in plugins/jetpack already migrated to Badge in
the prior commits on this branch, so the deprecated Chip is unused
inside the monorepo.

Refs #48160.
…cation

The Chip component's deprecation note, README, and changelog entry still
pointed consumers at `intent="success"`, but `@wordpress/ui@0.11.0` Badge
has no `success` intent. Valid values are
high | medium | low | stable | informational | draft | none.

The call-site code already uses `intent="stable"` after 3addf04;
this sync'd the docs/JSDoc/changelog that migrators will actually read.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CGastrell
CGastrell force-pushed the update/components-chip-use-wp-ui branch from b137407 to 5616bc5 Compare April 24, 2026 16:07
@CGastrell
CGastrell merged commit 2360b93 into trunk Apr 27, 2026
110 of 111 checks passed
@CGastrell
CGastrell deleted the update/components-chip-use-wp-ui branch April 27, 2026 14:07
@github-actions github-actions Bot added this to the jetpack/15.8 milestone Apr 27, 2026
CGastrell added a commit that referenced this pull request May 13, 2026
Part of #48160.

Replace the internal Jetpack Status component (from
@automattic/jetpack-components) with inline JSX using Text from
@wordpress/ui plus a small colour-coded indicator span in the six
consumer sites in plugins/protect and plugins/jetpack:

- protect: AdminSectionHero storybook, firewall hero, scan hero, scan
  history hero -- single Status sites, inline style blocks keep the
  same var(--jp-green-50|gray-50) colour vars, 0.666em indicator,
  font-weight 600, and line-height 1.666 as the wrapper SCSS.
- jetpack: security/waf "Standalone mode" label -- inline style,
  preserves the waf__standalone__mode className.
- jetpack: pro-status renders four different status states; co-locate
  a style.module.scss mirroring the wrapper's status colour map
  (is-active|inactive|error|action|initializing) so the four call
  sites stay terse. Also drop the dead text prop on the legacy
  rewind status site (the original wrapper only ever read "label")
  and fall back to the now-explicit default label per status.

Annotate the Status source in js-packages/components with an
@deprecated JSDoc block (mirroring the Chip -> Badge pattern from
#48162) so external consumers see the guidance without breaking on
upgrade. Implementation, styles, stories, and barrel export are
otherwise unchanged.
CGastrell added a commit that referenced this pull request May 18, 2026
Part of #48160.

Replace the internal Jetpack Status component (from
@automattic/jetpack-components) with inline JSX using Text from
@wordpress/ui plus a small colour-coded indicator span in the six
consumer sites in plugins/protect and plugins/jetpack:

- protect: AdminSectionHero storybook, firewall hero, scan hero, scan
  history hero -- single Status sites, inline style blocks keep the
  same var(--jp-green-50|gray-50) colour vars, 0.666em indicator,
  font-weight 600, and line-height 1.666 as the wrapper SCSS.
- jetpack: security/waf "Standalone mode" label -- inline style,
  preserves the waf__standalone__mode className.
- jetpack: pro-status renders four different status states; co-locate
  a style.module.scss mirroring the wrapper's status colour map
  (is-active|inactive|error|action|initializing) so the four call
  sites stay terse. Also drop the dead text prop on the legacy
  rewind status site (the original wrapper only ever read "label")
  and fall back to the now-explicit default label per status.

Annotate the Status source in js-packages/components with an
@deprecated JSDoc block (mirroring the Chip -> Badge pattern from
#48162) so external consumers see the guidance without breaking on
upgrade. Implementation, styles, stories, and barrel export are
otherwise unchanged.
CGastrell added a commit that referenced this pull request May 18, 2026
…#48711)

* Componentry: migrate Status to @wordpress/ui Text in plugin consumers

Part of #48160.

Replace the internal Jetpack Status component (from
@automattic/jetpack-components) with inline JSX using Text from
@wordpress/ui plus a small colour-coded indicator span in the six
consumer sites in plugins/protect and plugins/jetpack:

- protect: AdminSectionHero storybook, firewall hero, scan hero, scan
  history hero -- single Status sites, inline style blocks keep the
  same var(--jp-green-50|gray-50) colour vars, 0.666em indicator,
  font-weight 600, and line-height 1.666 as the wrapper SCSS.
- jetpack: security/waf "Standalone mode" label -- inline style,
  preserves the waf__standalone__mode className.
- jetpack: pro-status renders four different status states; co-locate
  a style.module.scss mirroring the wrapper's status colour map
  (is-active|inactive|error|action|initializing) so the four call
  sites stay terse. Also drop the dead text prop on the legacy
  rewind status site (the original wrapper only ever read "label")
  and fall back to the now-explicit default label per status.

Annotate the Status source in js-packages/components with an
@deprecated JSDoc block (mirroring the Chip -> Badge pattern from
#48162) so external consumers see the guidance without breaking on
upgrade. Implementation, styles, stories, and barrel export are
otherwise unchanged.

* Componentry: address review - design tokens + CSS classes (no inline styles)

- Replace all --jp-* color vars with --wpds-color-fg-content-* design tokens
  (success/error/warning/info/neutral-weak) in pro-status and protect heroes.
- waf.jsx: drop the inline style blocks; move styling under the existing
  .waf__standalone__mode class in _inc/client/security/style.scss.
- Protect heroes: extract a small AdminSectionHero.StatusIndicator helper
  co-located with the existing admin-section-hero module so the four
  consumers (storybook, firewall, scan, scan history) share one CSS source
  instead of duplicating inline style blocks.
- Update the @deprecated JSDoc on the Status component to point at the new
  WPDS tokens so future consumers do not reintroduce --jp-*.

Addresses review comments r3228168471, r3228177952, r3228180635 on PR #48711.

* Componentry: fix Status indicator color regression (use *-weak WPDS tokens + hex fallback)

The previous commit switched to --wpds-color-fg-content-success / -error /
-warning / -info, but those are the "ink" tokens used as text on tinted
backgrounds in alerts/badges — they resolve to near-black hexes (e.g.
success = #2900) and are visually indistinguishable from `color: inherit`
for a small dot + label. The Status indicator is a standalone color-coded
element on a plain admin-page background, so it needs the recognizable shade
family — the *-weak tokens:

  success-weak = #8030  ≈ --jp-green-50 (#8710)
  error-weak   = #cc1818  ≈ --jp-red-50   (#d63638)
  warning-weak = #926300  ≈ --jp-yellow-* (warm amber)
  info-weak    = #006bd7  ≈ --jp-blue-*   (link blue)
  neutral-weak = #707070  ≈ --jp-gray-50  (#646970)

In addition, the legacy Jetpack settings dashboard (which hosts the WAF
standalone-mode indicator and the Pro Status panel) does NOT load
`@wordpress/theme/design-tokens.css` at all — so any --wpds-* variable
resolves to empty/initial there, and the indicator falls back to
`color: inherit`. Add a hex fallback inside each var(--wpds-…, #rrggbb) so
the legacy dashboard renders the right shade without depending on the
design-tokens stylesheet being enqueued.

Verified in DevTools on the live dev site:
- /wp-admin/admin.php?page=jetpack-protect#/scan → indicator color now
  rgb(0, 128, 48) (was rgb(0, 41, 0) near-black).
- /wp-admin/admin.php?page=jetpack-protect#/firewall → same.
- /wp-admin/admin.php?page=jetpack (legacy dashboard) → WPDS token
  resolves empty but the #8030 fallback paints correctly.

Also update the @deprecated JSDoc on the Status component to point at the
*-weak tokens and to mention the hex-fallback requirement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu Docs [JS Package] Components [Package] My Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants