Skip to content

feat(web-components): migrate user-avatar from carbon-for-ibm-products - #23051

Open
anamikaanu96 wants to merge 21 commits into
carbon-design-system:mainfrom
anamikaanu96:migrateUserAvatar_wc
Open

feat(web-components): migrate user-avatar from carbon-for-ibm-products#23051
anamikaanu96 wants to merge 21 commits into
carbon-design-system:mainfrom
anamikaanu96:migrateUserAvatar_wc

Conversation

@anamikaanu96

@anamikaanu96 anamikaanu96 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Closes #22949

DO NOT MERGE UNTIL PR 22936 IS MERGED

This PR migrates the UserAvatar component from carbon-for-ibm-products into @carbon/web-components, continuing the migration strategy established in #22936 and defined in ADR-0007. The component is added as pre-release / feature-flagged work — excluded from the v11 published build and v11 Storybook, and available exclusively in the v12 Storybook until the next major release.

The component ships with:

  • LitElement class (user-avatar.ts) with full property reflection and TypeScript types
  • Component styles (user-avatar.scss) scoped to :host()
  • Storybook stories (user-avatar.stories.ts) with CSF3 format and controls
  • MDX docs page (user-avatar.mdx)
  • Unit tests (__tests__/user-avatar-test.js) using @open-wc/testing
  • index.ts for element registration
  • Story assets (_story-assets/headshot.jpg) for image demos

Changelog

New

  • cds-user-avatar — displays a user avatar with support for profile image, name initials (derived from full name or explicit initials), and a fallback icon. Supports configurable size, background-color, tooltip-text, and tooltip-alignment props. Migrated from @carbon/ibm-products.
  • packages/web-components/src/components/user-avatar/ — full component directory with user-avatar.ts, user-avatar.scss, user-avatar.stories.ts, user-avatar.mdx, index.ts, story-styles.scss, __tests__/user-avatar-test.js, and _story-assets/headshot.jpg

Changed

  • packages/web-components/product-migrated-components.mjs — updated to include cds-user-avatar story and MDX globs for v11/v12 Storybook gating and build exclusion
  • packages/web-components/src/index.ts — export for cds-user-avatar added (commented out until graduation to stable release)

Testing / Reviewing

  1. v11 Storybook — run yarn storybook in packages/web-components. Confirm UserAvatar does not appear in the sidebar.
  2. v12 Storybook — run yarn storybook:v12 in packages/web-components. Confirm UserAvatar appears under its category with working controls (size, background color, image, name, tooltip), no console errors, and correct MDX docs.
  3. Unit tests — run yarn test in packages/web-components. All tests in src/components/user-avatar/__tests__/user-avatar-test.js should pass.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Followed the
    required v12 migration documentation
    for any code change that affects v12, or struck through this item because
    the PR does not affect v12
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@anamikaanu96
anamikaanu96 requested a review from a team as a code owner August 19, 2026 07:02
@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for v3-carbon-web-components ready!

Name Link
🔨 Latest commit 440e038
🔍 Latest deploy log https://app.netlify.com/projects/v3-carbon-web-components/deploys/6a855517bc099e00082d2244
😎 Deploy Preview https://deploy-preview-23051--v3-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for v2-carbon-react ready!

Name Link
🔨 Latest commit 440e038
🔍 Latest deploy log https://app.netlify.com/projects/v2-carbon-react/deploys/6a855517d80ff400081d0543
😎 Deploy Preview https://deploy-preview-23051--v2-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 440e038
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6a855517356d0d0008652325
😎 Deploy Preview https://deploy-preview-23051--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 440e038
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6a8555178f156300083209d3
😎 Deploy Preview https://deploy-preview-23051--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 440e038
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6a8555174a411e0008019a91
😎 Deploy Preview https://deploy-preview-23051--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.43444% with 240 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.52%. Comparing base (bb09811) to head (440e038).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...components/src/components/side-panel/side-panel.ts 84.06% 82 Missing and 2 partials ⚠️
...s/src/components/side-panel/_story-assets/index.ts 76.77% 62 Missing ⚠️
...omponents/src/components/resizer/resizer-handle.ts 88.65% 49 Missing ⚠️
...components/src/components/action-set/action-set.ts 96.31% 17 Missing and 1 partial ⚠️
...ages/web-components/src/components/resizer/defs.ts 94.59% 10 Missing ⚠️
...ts/src/components/truncated-text/truncated-text.ts 96.59% 9 Missing ⚠️
...nts/src/components/resizer/resizer-handle-pivot.ts 95.95% 1 Missing and 3 partials ⚠️
...mponents/src/components/user-avatar/user-avatar.ts 97.41% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23051      +/-   ##
==========================================
+ Coverage   89.83%   90.52%   +0.69%     
==========================================
  Files         615      284     -331     
  Lines       55295    43924   -11371     
  Branches     7829     2505    -5324     
==========================================
- Hits        49674    39764    -9910     
+ Misses       5475     4134    -1341     
+ Partials      146       26     -120     
Flag Coverage Δ
main-packages ?
web-components 90.52% <90.43%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate UserAvatar web component from ibm-products to @carbon/web-components

2 participants