feat(ui): add Mosaic Badge component - #9221
Conversation
🦋 Changeset detectedLatest commit: 890fc06 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds a new Mosaic Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/mosaic-badge.md:
- Around line 1-2: Replace the empty frontmatter in mosaic-badge.md with a
changeset entry for `@clerk/ui` using a minor release level, preserving the
required changeset format so the new public Badge component and props API
generate a package bump and changelog entry.
In `@packages/swingset/src/stories/badge.stories.tsx`:
- Around line 1-2: Add the required top-level Emotion JSX import-source pragma
to the badge story before its imports, while preserving the existing BadgeProps
and Badge imports.
In `@packages/ui/src/mosaic/components/badge/badge.tsx`:
- Around line 18-19: Update the Badge component’s prop spread order so rest
props are applied before the component-owned themeProps result, preventing
consumers from overriding the resolved intent metadata. Preserve the existing
style and className resolution, and add a regression test covering an intent
such as success with conflicting rest metadata to verify the resolved intent
wins.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: f2fefe08-7668-4d38-97b4-36691ea6f821
📒 Files selected for processing (11)
.changeset/mosaic-badge.mdpackages/swingset/src/components/DocsViewer.tsxpackages/swingset/src/lib/registry.tspackages/swingset/src/stories/badge.mdxpackages/swingset/src/stories/badge.stories.tsxpackages/ui/src/mosaic/components/badge/badge.styles.tspackages/ui/src/mosaic/components/badge/badge.test.tsxpackages/ui/src/mosaic/components/badge/badge.tsxpackages/ui/src/mosaic/components/badge/index.tspackages/ui/src/mosaic/styles/index.tspackages/ui/src/mosaic/tokens.stylex.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)
| import type { BadgeProps } from '@clerk/ui/mosaic/components/badge'; | ||
| import { Badge } from '@clerk/ui/mosaic/components/badge'; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add the required Emotion JSX pragma.
This story renders a styled Mosaic component but lacks the required top-level @jsxImportSource pragma.
+/** `@jsxImportSource` `@emotion/react` */
+
import type { BadgeProps } from '`@clerk/ui/mosaic/components/badge`';As per coding guidelines, “Use Emotion pragma /** @jsxImportSource @emotion/react */ at the top of story files that render styled Mosaic components.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import type { BadgeProps } from '@clerk/ui/mosaic/components/badge'; | |
| import { Badge } from '@clerk/ui/mosaic/components/badge'; | |
| /** `@jsxImportSource` `@emotion/react` */ | |
| import type { BadgeProps } from '`@clerk/ui/mosaic/components/badge`'; | |
| import { Badge } from '`@clerk/ui/mosaic/components/badge`'; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/swingset/src/stories/badge.stories.tsx` around lines 1 - 2, Add the
required top-level Emotion JSX import-source pragma to the badge story before
its imports, while preserving the existing BadgeProps and Badge imports.
Source: Coding guidelines
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/mosaic/components/badge/badge.styles.ts`:
- Around line 34-43: Update the warning and success variants in the badge styles
to meet at least 4.5:1 contrast for label-sm text in light and dark themes,
using appropriate contrast-paired foreground tokens or adjusted faded fills
while leaving destructive unchanged. Add contrast tests covering warning in
light mode and success in dark mode.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 359f20ad-7b5b-46fc-9c96-2cef54c7e062
📒 Files selected for processing (2)
packages/ui/src/mosaic/components/badge/badge.styles.tspackages/ui/src/mosaic/tokens.stylex.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)clerk/clerk-ios(auto-detected)clerk/cli(auto-detected)clerk/clerk-android(auto-detected)
173b95d to
ba4d13a
Compare
- values: secondary→neutral, destructive→negative, success→positive - swingset PropTable: sx row now opt-out (Badge is StyleX, no sx) - docs: document render prop
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/mosaic/tokens.stylex.ts`:
- Around line 29-44: Restore the deprecated --cl-color-destructive* and
--cl-color-muted* aliases in the exported colorVars alongside the replacement
negative and neutral tokens. Map each alias to its corresponding current token,
preserving compatibility for existing SDK styles and consumer customizations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: d6a66e4b-7245-437c-97f3-09c71b4ce92f
📒 Files selected for processing (13)
.changeset/mosaic-badge.mdpackages/swingset/src/components/DocsViewer.tsxpackages/swingset/src/components/PropTable.tsxpackages/swingset/src/lib/registry.tspackages/swingset/src/stories/badge.mdxpackages/swingset/src/stories/badge.stories.tsxpackages/ui/src/mosaic/components/badge/badge.styles.tspackages/ui/src/mosaic/components/badge/badge.test.tsxpackages/ui/src/mosaic/components/badge/badge.tsxpackages/ui/src/mosaic/components/badge/index.tspackages/ui/src/mosaic/styles/index.tspackages/ui/src/mosaic/tokens.stylex.tspackages/ui/tsdown.mosaic.config.mts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (5)
- packages/ui/src/mosaic/components/badge/index.ts
- packages/ui/src/mosaic/styles/index.ts
- packages/swingset/src/components/DocsViewer.tsx
- packages/swingset/src/stories/badge.mdx
- packages/swingset/src/lib/registry.ts
Adds Mosaic
Badge. StyleX,spanroot, oneintentaxis:primary | secondary | warning | destructive | success.Preview: https://swingset-git-carp-mosaic-badge.clerkstage.dev/components/badge