Skip to content

refactor(identity): migrate deprecated component-library imports to @metamask/design-system-react#41448

Merged
gantunesr merged 2 commits intomainfrom
refactor/accounts-identity-dsr-migration
Apr 8, 2026
Merged

refactor(identity): migrate deprecated component-library imports to @metamask/design-system-react#41448
gantunesr merged 2 commits intomainfrom
refactor/accounts-identity-dsr-migration

Conversation

@gantunesr
Copy link
Copy Markdown
Member

@gantunesr gantunesr commented Apr 2, 2026

Description

Migrates deprecated Box, Text, Icon, IconName, Button, ButtonVariant, and ButtonSize imports from the internal ui/components/component-library to @metamask/design-system-react in the accounts-team-owned identity components.

Why: The component-library versions are all marked @deprecated and will be removed in a future release. This is PR 2 of a planned series to eliminate deprecated imports across all accounts-team-owned files.

Files changed (4):

  • ui/components/app/identity/backup-and-sync-toggle/backup-and-sync-toggle.tsx
  • ui/components/app/identity/backup-and-sync-features-toggles/backup-and-sync-features-toggles.tsx
  • ui/components/app/modals/identity/turn-on-backup-and-sync-modal/turn-on-backup-and-sync-modal.tsx
  • ui/components/app/modals/identity/confirm-turn-on-backup-and-sync-modal/confirm-turn-on-backup-and-sync-modal.tsx

Key API migration notes:

  • Box: display={Display.Flex} removed; flexDirection={BoxFlexDirection.Row} used instead (DSR Box auto-applies display:flex when flexDirection is set). Box as="img" converted to a plain <img> element (DSR Box does not support the as polymorphic prop).
  • Text: camelCase enum variants (bodyMd, textAlternative) updated to PascalCase (BodyMd, TextAlternative). bodyMdMedium replaced with BodyMd + fontWeight={FontWeight.Medium}. as="a" / as="div" usages replaced with the asChild pattern (Radix Slot). Spacing props on Text moved to a wrapping Box.
  • Button: import source updated; width={BlockSize.Half} replaced with className="w-1/2".
  • Modal* components (Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter) remain imported from component-library — they are not yet available in @metamask/design-system-react.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Made with Cursor


Note

Low Risk
Pure UI refactor swapping component imports and prop APIs; main risk is small visual/layout regressions (spacing, link rendering) rather than behavioral changes.

Overview
Refactors the Backup & Sync settings UI and related modals to replace deprecated component-library Box/Text/Icon/Button usage with @metamask/design-system-react equivalents.

This updates layout and typography props (e.g., BoxFlexDirection/BoxJustifyContent, TextVariant/TextColor casing, FontWeight), switches various Text as=... usages to the asChild pattern, and replaces a polymorphic Box as="img" with a plain <img> plus utility classes (e.g., w-1/2, rounded-md).

Reviewed by Cursor Bugbot for commit 0b1ccbc. Bugbot is set up for automated code reviews on this repo. Configure here.

…metamask/design-system-react

Replace deprecated Box, Text, Icon, IconName, Button, ButtonVariant, and
ButtonSize imports from ui/components/component-library with their equivalents
from @metamask/design-system-react in the identity and identity-modal components.

Key API changes applied:
- Box: display+flexDirection enums replaced with BoxFlexDirection/BoxAlignItems/
  BoxJustifyContent; Box as="img" replaced with a plain <img> element
- Text: camelCase enums (bodyMd, textAlternative) updated to PascalCase
  (BodyMd, TextAlternative); bodyMdMedium replaced with BodyMd+FontWeight.Medium;
  as="a" / as="div" replaced with asChild pattern; spacing props on Text moved
  to wrapping Box
- Button: ButtonSize.Lg, ButtonVariant.Primary/Secondary import source updated;
  width={BlockSize.Half} replaced with className="w-1/2"
- ModalContent/ModalHeader/ModalFooter/Modal* kept from component-library
  (not yet available in DSR)

Made-with: Cursor
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented Apr 2, 2026

✨ Files requiring CODEOWNER review ✨

🔑 @MetaMask/accounts-engineers (4 files, +154 -147)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 identity/
          • 📁 backup-and-sync-features-toggles/
            • 📄 backup-and-sync-features-toggles.tsx +27 -22
          • 📁 backup-and-sync-toggle/
            • 📄 backup-and-sync-toggle.tsx +36 -33
        • 📁 modals/
          • 📁 identity/
            • 📁 confirm-turn-on-backup-and-sync-modal/
              • 📄 confirm-turn-on-backup-and-sync-modal.tsx +27 -39
            • 📁 turn-on-backup-and-sync-modal/
              • 📄 turn-on-backup-and-sync-modal.tsx +64 -53

@github-actions github-actions Bot added the size-M label Apr 2, 2026
@gantunesr gantunesr marked this pull request as ready for review April 2, 2026 15:16
@gantunesr gantunesr requested a review from a team as a code owner April 2, 2026 15:16
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented Apr 2, 2026

Builds ready [a0fc958]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): a6803cd | Date: 1/23/58222 | Pipeline: 23907513674 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount🟢 [Show logs]
confirmTx🟢 [Show logs]
bridgeUserActions🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: +18%
  • loadNewAccount/total: +18%
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupPowerUserHome/backgroundConnect: -35%
  • startupPowerUserHome/numNetworkReqs: +132%
  • startupPowerUserHome/uiStartup: +10%
  • startupPowerUserHome/domInteractive: -16%
  • startupPowerUserHome/backgroundConnect: +13%
  • startupPowerUserHome/numNetworkReqs: +28%
  • startupStandardHome/backgroundConnect: -11%
  • startupStandardHome/initialActions: -29%
  • startupStandardHome/setupStore: -11%
  • startupPowerUserHome/uiStartup: +11%
  • startupPowerUserHome/domInteractive: +10%
  • startupPowerUserHome/backgroundConnect: +19%
  • startupPowerUserHome/setupStore: +28%
  • startupStandardHome/initialActions: -29%
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟢 [Show logs]
solanaAssetDetails🟢 [Show logs]
importSrpHome🟢 [Show logs]
sendTransactions🟢 [Show logs]
swap🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/metricsToWalletReadyScreen: -39%
  • onboardingImportWallet/doneButtonToHomeScreen: -73%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +83%
  • onboardingImportWallet/total: -37%
  • onboardingNewWallet/skipBackupToMetricsScreen: +24%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -41%
  • onboardingNewWallet/doneButtonToAssetList: -38%
  • onboardingNewWallet/total: -32%
  • assetDetails/assetClickToPriceChart: -55%
  • assetDetails/total: -55%
  • solanaAssetDetails/assetClickToPriceChart: -58%
  • solanaAssetDetails/total: -58%
  • importSrpHome/openAccountMenuAfterLogin: -22%
  • importSrpHome/homeAfterImportWithNewWallet: -37%
  • importSrpHome/total: -31%
  • swap/openSwapPageFromHome: -86%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +12%
🌐 Dapp Page Load Benchmarks

Current Commit: a0fc958 | Date: 4/2/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±54ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 743ms (±52ms) 🟢 | historical mean value: 727ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 86ms (±12ms) 🟢 | historical mean value: 85ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 54ms 1.01s 1.34s 1.12s 1.34s
domContentLoaded 743ms 52ms 706ms 1.02s 805ms 1.02s
firstPaint 86ms 12ms 72ms 180ms 96ms 180ms
firstContentfulPaint 86ms 12ms 72ms 180ms 96ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 67 Bytes (0%)
  • common: 7.56 KiB (0.06%)

Copy link
Copy Markdown
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

Code LGTM. The tricky and most resource-intensive part of these migrations is visual regression testing. The code looks great, and I’m 80% to 90% confident this won’t introduce visual regressions, but without validating against visual assets, we can’t be fully certain.

I’ll leave that to your discretion.

@gantunesr
Copy link
Copy Markdown
Member Author

UI looks in order

Screen.Recording.2026-04-07.at.5.28.11.PM.mov

@gantunesr gantunesr added this pull request to the merge queue Apr 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 7, 2026
@gantunesr gantunesr added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 8, 2026
@gantunesr gantunesr added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 8, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@gantunesr gantunesr enabled auto-merge April 8, 2026 10:21
@gantunesr gantunesr added this pull request to the merge queue Apr 8, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented Apr 8, 2026

Builds ready [0b1ccbc]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24129206184 | Baseline logs

Interaction Benchmarks · Samples: 5
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -16%
  • loadNewAccount/total: -16%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.6s
  • 🟡 loadNewAccount/LCP: p75 2.5s
  • 🟡 confirmTx/FCP: p75 2.5s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks · Samples: 100
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: +19%
  • startupStandardHome/load: +15%
  • startupStandardHome/domContentLoaded: +13%
  • startupStandardHome/domInteractive: +127%
  • startupStandardHome/firstPaint: +40%
  • startupStandardHome/backgroundConnect: +43%
  • startupStandardHome/firstReactRender: +21%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/loadScripts: +12%
  • startupStandardHome/setupStore: +46%
  • startupPowerUserHome/uiStartup: -12%
  • startupPowerUserHome/domInteractive: -12%
  • startupPowerUserHome/backgroundConnect: +121%
  • startupPowerUserHome/setupStore: +22%
  • startupPowerUserHome/numNetworkReqs: -13%
  • startupStandardHome/uiStartup: -11%
  • startupStandardHome/load: -10%
  • startupStandardHome/firstPaint: +26%
  • startupStandardHome/backgroundConnect: -32%
  • startupStandardHome/firstReactRender: -20%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -20%
  • startupPowerUserHome/firstPaint: -15%
  • startupPowerUserHome/numNetworkReqs: +12%
  • startupStandardHome/domInteractive: -56%
  • startupStandardHome/backgroundConnect: +11%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/setupStore: +21%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/domInteractive: +12%
  • startupPowerUserHome/backgroundConnect: -22%
  • startupStandardHome/domInteractive: -30%
  • startupStandardHome/backgroundConnect: -17%
  • startupStandardHome/initialActions: -44%
  • startupStandardHome/setupStore: -60%
  • startupPowerUserHome/backgroundConnect: -29%
  • startupPowerUserHome/setupStore: -16%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 776ms
  • 🔴 startupPowerUserHome/INP: p75 792ms
  • 🟡 startupPowerUserHome/LCP: p75 3.5s
  • 🟡 startupPowerUserHome/INP: p75 312ms
  • 🟡 startupPowerUserHome/LCP: p75 3.7s
User Journey Benchmarks · Samples: 5 · mock API
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/srpButtonToSrpForm: -85%
  • onboardingImportWallet/metricsToWalletReadyScreen: -35%
  • onboardingImportWallet/doneButtonToHomeScreen: -77%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +53%
  • onboardingImportWallet/total: -35%
  • onboardingNewWallet/srpButtonToPwForm: -77%
  • onboardingNewWallet/skipBackupToMetricsScreen: -65%
  • onboardingNewWallet/doneButtonToAssetList: -27%
  • onboardingNewWallet/total: -28%
  • assetDetails/assetClickToPriceChart: -48%
  • assetDetails/total: -48%
  • solanaAssetDetails/assetClickToPriceChart: -68%
  • solanaAssetDetails/total: -68%
  • importSrpHome/openAccountMenuAfterLogin: -77%
  • importSrpHome/homeAfterImportWithNewWallet: -69%
  • importSrpHome/total: -60%
  • sendTransactions/openSendPageFromHome: -10%
  • sendTransactions/selectTokenToSendFormLoaded: -31%
  • sendTransactions/reviewTransactionToConfirmationPage: +34%
  • sendTransactions/total: +31%
  • swap/openSwapPageFromHome: -96%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +11%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/FCP: p75 2.5s
  • 🟡 solanaAssetDetails/FCP: p75 2.4s
  • 🟡 importSrpHome/INP: p75 208ms
  • 🟡 importSrpHome/FCP: p75 2.5s
  • 🟡 sendTransactions/INP: p75 256ms
  • 🟡 sendTransactions/FCP: p75 2.5s
  • 🟡 swap/FCP: p75 2.5s
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-browserify
dappPageLoad🟢 [Show logs]
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 39 Bytes (0%)
  • common: 20 Bytes (0%)

Merged via the queue into main with commit e89b851 Apr 8, 2026
209 of 211 checks passed
@gantunesr gantunesr deleted the refactor/accounts-identity-dsr-migration branch April 8, 2026 11:10
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 8, 2026
@metamaskbot metamaskbot added the release-13.27.0 Issue or pull request that will be included in release 13.27.0 label Apr 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.27.0 Issue or pull request that will be included in release 13.27.0 size-M team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants