Skip to content

feat(DSYS-475): Migrate AvatarGroup to ADR-0003 and ADR-0004#1067

Merged
georgewrmarshall merged 6 commits into
mainfrom
cursor/enum-shared-type-migration-a274
May 1, 2026
Merged

feat(DSYS-475): Migrate AvatarGroup to ADR-0003 and ADR-0004#1067
georgewrmarshall merged 6 commits into
mainfrom
cursor/enum-shared-type-migration-a274

Conversation

@cursor

@cursor cursor Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates the AvatarGroup component to align with ADR-0003 (String Unions) and ADR-0004 (Centralized Types Architecture) as part of epic DSYS-468.

Changes:

  • Shared package (@metamask/design-system-shared):

    • Added AvatarGroupVariant const object (ADR-0003), replacing the duplicated enum in both platform packages
    • Added AvatarGroupSize alias (= AvatarBaseSize) for convenience
    • Added AvatarGroupPropsShared type with shared props: variant, size, max, isReverse (ADR-0004)
    • Exported from packages/design-system-shared/src/index.ts
  • React package (@metamask/design-system-react):

    • Removed AvatarGroupVariant enum from src/types/index.ts; replaced with re-export from shared
    • Updated AvatarGroup.types.ts to use AvatarGroupPropsShared and Extract<AvatarGroupVariant, ...> in discriminated union
    • Updated AvatarGroup.tsx and AvatarGroup.constants.ts to import from shared
    • Updated index.ts to export AvatarGroupSize and AvatarGroupVariant directly from shared
  • React Native package (@metamask/design-system-react-native):

    • Same changes as React package, mirrored for the RN platform

Related issues

Fixes: DSYS-475

Manual testing steps

  1. Build the packages: yarn build
  2. Run tests: yarn test
  3. Verify AvatarGroupVariant and AvatarGroupSize are exported from @metamask/design-system-shared
  4. Verify existing AvatarGroup stories render correctly: yarn storybook

Screenshots/Recordings

After

No visual changes

avatargroup720.mov

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

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.
Open in Web View Automation 

Note

Medium Risk
Medium risk due to API/type surface changes and re-export removal that could break downstream imports or discriminated unions if any consumer relied on the old types exports.

Overview
Migrates AvatarGroup (React and React Native) to centralized shared types per ADR-0003/0004 by adding AvatarGroupVariant (string-union const), AvatarGroupSize alias, and AvatarGroupPropsShared to @metamask/design-system-shared, and updating components/stories/tests/constants to import these directly.

Removes the duplicated AvatarGroupVariant enum and AvatarGroupSize re-export from the platform src/types/index.ts files, while keeping component-level index.ts re-exports pointing at shared for compatibility. Also aligns React AvatarGroup’s useCallback dependencies to include values used in the render switch (e.g., variant/negative spacing) to avoid stale renders.

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

@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

@georgewrmarshall georgewrmarshall force-pushed the cursor/enum-shared-type-migration-a274 branch from d363e60 to 5faeb1e Compare April 30, 2026 21:57
@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

Comment thread packages/design-system-react-native/src/types/index.ts Outdated
Comment thread packages/design-system-react-native/src/types/index.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 79cb635. Configure here.

Comment thread packages/design-system-react/src/types/index.ts Outdated
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

@georgewrmarshall georgewrmarshall marked this pull request as ready for review May 1, 2026 19:10
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner May 1, 2026 19:10
cursoragent and others added 6 commits May 1, 2026 12:11
- Add AvatarGroupVariant const object to design-system-shared (ADR-0003)
- Add AvatarGroupSize alias (= AvatarBaseSize) to design-system-shared
- Add AvatarGroupPropsShared type with variant, size, max, isReverse (ADR-0004)
- Export from shared package index.ts
- Remove AvatarGroupVariant enum from both platform types/index.ts
- Update React and React Native AvatarGroup components to import from shared
- Update index.ts in both platforms to re-export from shared
- Use Extract<AvatarGroupVariant, 'account'|...> pattern in discriminated union types

Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
@georgewrmarshall georgewrmarshall force-pushed the cursor/enum-shared-type-migration-a274 branch from 3ffad6e to 6239f8e Compare May 1, 2026 19:11
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

📖 Storybook Preview

@georgewrmarshall georgewrmarshall enabled auto-merge (squash) May 1, 2026 19:27
@georgewrmarshall georgewrmarshall merged commit 2c7728e into main May 1, 2026
44 checks passed
@georgewrmarshall georgewrmarshall deleted the cursor/enum-shared-type-migration-a274 branch May 1, 2026 19:35
@georgewrmarshall georgewrmarshall mentioned this pull request May 5, 2026
20 tasks
georgewrmarshall added a commit that referenced this pull request May 5, 2026
## Release 38.0.0

This release updates the shared, web, native, tokens, and Tailwind
packages with new cross-platform input and avatar-group contracts, new
modal building blocks for React, a breaking React Native Toast API
redesign, and Tailwind CSS v4 support for web consumers.

### 📦 Package Versions

- `@metamask/design-system-shared`: **0.16.0**
- `@metamask/design-system-react`: **0.21.0**
- `@metamask/design-system-react-native`: **0.23.0**
- `@metamask/design-system-tailwind-preset`: **0.7.0**
- `@metamask/design-tokens`: **8.4.0**

### 🔄 Shared Type Updates (0.16.0)

#### Input and AvatarGroup shared contracts
([#1043](#1043),
[#1067](#1067))

**What Changed:**

- Added shared `Input` contracts for controlled `value`, `isReadOnly`,
and `isStateStylesDisabled`
- Added shared `AvatarGroup` size, variant, and prop contracts
- Added the shared `Merge` icon export
([#1155](#1155))

**Impact:**

- React and React Native consumers can build against one aligned input
and avatar-group API surface
- Cross-platform wrappers can depend on `@metamask/design-system-shared`
instead of maintaining platform-specific type assumptions

### 🌐 React Web Updates (0.21.0)

#### Added

- Added `ModalOverlay`, `ModalBody`, `ModalFocus`, and `ModalFooter` to
support Extension modal migrations into `@metamask/design-system-react`
([#1120](#1120),
[#1121](#1121),
[#1128](#1128),
[#1132](#1132))
- Added the `Merge` icon to the React icon set
([#1155](#1155))

#### Changed

- Updated `Input` to follow the shared controlled input API and use
`isReadOnly` as the public readonly prop name
([#1043](#1043))
- Updated `AvatarGroup` to use shared cross-platform size and variant
contracts
([#1067](#1067))

### 📱 React Native Updates (0.23.0)

#### Added

- Added the `Merge` icon to the React Native icon set
([#1155](#1155))

#### Changed

- **BREAKING:** Redesigned `Toast` to use a single mounted `<Toast />`
plus static `Toast.show(...)` and `Toast.hide()` methods for application
usage
([#1104](#1104))
- Removed `ToastContext`, `ToastContextWrapper`, and
`ToastContextParams` from the public export surface
- Renamed `ToastVariants` to `ToastVariant`, changed icon-only close
buttons to `ToastCloseButtonVariant.Icon`, and renamed
`customBottomOffset` to `bottomOffset`
- `Toast.show()` and `Toast.hide()` now throw a descriptive error if
called before `<Toast />` mounts
- See the [React Native Migration
Guide](./packages/design-system-react-native/MIGRATION.md#from-version-0220-to-0230)
- Updated `Input` to follow the shared controlled input API and rename
`isReadonly` to `isReadOnly`
([#1043](#1043))
- Updated `AvatarGroup` to use shared cross-platform size and variant
contracts
([#1067](#1067))

### 🎨 Tokens and Tailwind Updates

#### `@metamask/design-tokens` 8.4.0

- Added `@metamask/design-tokens/tailwind/theme.css` for Tailwind CSS v4
consumers, providing a single import for token variables, theme values,
typography, fonts, and shadow utilities
([#1117](#1117))

#### `@metamask/design-system-tailwind-preset` 0.7.0

- Added a `fade-in` animation utility so consumers can use
`animate-fade-in` for simple opacity entrance transitions, including the
new `ModalOverlay` web migration path
([#1120](#1120))
- Clarified that Tailwind CSS v3 consumers should keep using this
preset, while Tailwind CSS v4 consumers should migrate to
`@metamask/design-tokens/tailwind/theme.css`
([#1117](#1117))

### ⚠️ Breaking Changes

#### Toast API redesign (React Native)

**What Changed:**

- `Toast` application usage moved from context/service patterns to
static `Toast.show(...)` and `Toast.hide()` methods
- `ToastContext`, `ToastContextWrapper`, and `ToastContextParams` were
removed from the public API
- `ToastVariants` was renamed to `ToastVariant`
- Icon-only close buttons now use `ToastCloseButtonVariant.Icon`
- `customBottomOffset` was renamed to `bottomOffset`

**Impact:**

- Existing `@metamask/design-system-react-native` consumers using the
old Toast context flow need import, root-mount, and call-site updates
- Existing app code must ensure `<Toast />` is mounted before invoking
`Toast.show()` / `Toast.hide()`

See migration guides for complete instructions:

- [React Native Migration
Guide](./packages/design-system-react-native/MIGRATION.md#from-version-0220-to-0230)

### ✅ Checklist

- [x] Changelogs updated with human-readable descriptions
- [x] Changelog validation passed (`yarn workspace <package>
changelog:validate`)
- [x] Version bumps follow semantic versioning
- [x] design-system-shared: minor (`0.15.0` → `0.16.0`) - new shared
`Input`, `AvatarGroup`, and icon exports
- [x] design-system-react: minor (`0.20.0` → `0.21.0`) - new modal
components, icon, and shared API alignment
- [x] design-system-react-native: minor (`0.22.0` → `0.23.0`) - breaking
Toast redesign, icon, and shared API alignment
- [x] design-system-tailwind-preset: minor (`0.6.1` → `0.7.0`) - new
`fade-in` utility and Tailwind CSS v4 migration guidance
- [x] design-tokens: minor (`8.3.0` → `8.4.0`) - Tailwind CSS v4
`theme.css` export
- [x] Breaking changes documented with migration guidance
- [x] Migration guides updated with before/after examples (if breaking
changes)
- [x] PR references included in changelog entries

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs)
- [ ] I've reviewed the [Release
Workflow](./.cursor/rules/release-workflow.md) cursor rule
- [ ] All tests pass (`yarn build && yarn test && yarn lint`)
- [x] Changelog validation passes (`yarn changelog:validate`)

## **Pre-merge reviewer checklist**

- [ ] I've reviewed the [Reviewing Release
PRs](./docs/reviewing-release-prs.md) guide
- [ ] Package versions follow semantic versioning
- [ ] Changelog entries are consumer-facing (not commit message
regurgitation)
- [ ] Breaking changes are documented in MIGRATION.md with examples
- [ ] All unreleased changes are accounted for in changelogs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants