Repository navigation
feat(ui): Mosaic field component - #9322
Conversation
🦋 Changeset detectedLatest commit: 1bcc702 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: |
57aeff6 to
fd49235
Compare
ca96e1b to
a6c399c
Compare
ee83a6e to
fcbd583
Compare
fcbd583 to
374b29c
Compare
cfe215d to
1ef2b96
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/components/field/field.context.tsx (1)
117-136: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftPreserve caller-provided control IDs during SSR.
Line 122 registers the supplied
idonly after commit. During SSR,context.controlIdremainsdefaultControlId.Inputthen uses that value before its ownid, so<Input id="email" />renders with a generated ID and changes after hydration.Derive the initial control ID during render, or provide it to
FieldProviderbefore descendant rendering. Add an SSR test that verifies the inputidand generated labelhtmlForboth use a caller-provided ID.🤖 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/ui/src/mosaic/components/field/field.context.tsx` around lines 117 - 136, Update the control-ID derivation in the field context render path so a caller-provided id is available during SSR, instead of relying only on the post-commit registerControlId effect. Ensure descendants such as Input and generated labels use that initial ID consistently, while preserving generated IDs when no id is supplied. Add an SSR test covering both the rendered input id and label htmlFor for a caller-provided ID.
🧹 Nitpick comments (1)
packages/ui/src/mosaic/components/field/field.tsx (1)
21-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the exported props interface.
Add concise JSDoc for
FieldRootProps. Document that its state props apply to composed controls through field context.As per coding guidelines, “All public APIs must be documented with JSDoc.”
🤖 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/ui/src/mosaic/components/field/field.tsx` around lines 21 - 25, Add concise JSDoc immediately above the exported FieldRootProps interface, documenting the interface and clarifying that its disabled, required, and invalid state props apply to composed controls through field context.Source: Coding guidelines
🤖 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.
Outside diff comments:
In `@packages/ui/src/mosaic/components/field/field.context.tsx`:
- Around line 117-136: Update the control-ID derivation in the field context
render path so a caller-provided id is available during SSR, instead of relying
only on the post-commit registerControlId effect. Ensure descendants such as
Input and generated labels use that initial ID consistently, while preserving
generated IDs when no id is supplied. Add an SSR test covering both the rendered
input id and label htmlFor for a caller-provided ID.
---
Nitpick comments:
In `@packages/ui/src/mosaic/components/field/field.tsx`:
- Around line 21-25: Add concise JSDoc immediately above the exported
FieldRootProps interface, documenting the interface and clarifying that its
disabled, required, and invalid state props apply to composed controls through
field context.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: f801a372-56ed-4ed9-9d67-a21a6ba88cac
📒 Files selected for processing (5)
packages/swingset/src/stories/field.component.mdxpackages/ui/src/mosaic/components/field/field.context.tsxpackages/ui/src/mosaic/components/field/field.test.tsxpackages/ui/src/mosaic/components/field/field.tsxpackages/ui/src/mosaic/components/input/input.tsx
🔗 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/cli(auto-detected)clerk/clerk-ios(auto-detected)clerk/clerk-android(auto-detected)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/swingset/src/stories/field.component.mdx
- packages/ui/src/mosaic/components/field/field.test.tsx
- packages/ui/src/mosaic/components/input/input.tsx
Description
https://swingset-git-mosaic-text-field-component.clerkstage.dev/components/field
Adds the Mosaic Field component:
Field.Root,Field.Label,Field.Description, andField.ErrorAPI.aria-*attributes.invalid,disabled, andrequiredto composed Mosaic inputs.alert-circleicon. Validation, error visibility, and lifecycle state such asdirty,touched,filled, andfocusedremain caller-owned.