Skip to content

feat(DSYS-488): Migrate Input to ADR-0003 and ADR-0004#1043

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/enum-shared-type-migration-6cf4
Draft

feat(DSYS-488): Migrate Input to ADR-0003 and ADR-0004#1043
cursor[bot] wants to merge 1 commit intomainfrom
cursor/enum-shared-type-migration-6cf4

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 6, 2026

Description

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

Changes

New shared types (@metamask/design-system-shared)

  • TextVariant — converted from duplicated enum TextVariant in both platform packages to a single const object with string union type (ADR-0003). Values are identical across React and React Native ('display-lg', 'body-md', etc.)
  • InputPropsShared — new shared props type (ADR-0004) containing the cross-platform Input props: textVariant, isDisabled, isReadonly

Updated platform packages

  • @metamask/design-system-react and @metamask/design-system-react-native:
    • Removed enum TextVariant from src/types/index.ts — now re-exported from shared
    • Input.types.ts imports InputPropsShared from shared and extends with platform-specific props (className/twClassName, value, isStateStylesDisabled)
    • Input, Text, and related component files updated to import TextVariant from @metamask/design-system-shared instead of local ../../types

Platform-specific props remain in platform packages

  • React: className, style
  • React Native: value (controlled), isStateStylesDisabled, twClassName

Related issues

Fixes: DSYS-488

Manual testing steps

  1. Run yarn build — all packages build successfully
  2. Run yarn test — all tests pass with 100% coverage on changed components
  3. Verify TextVariant is importable from @metamask/design-system-shared
  4. Verify InputPropsShared is importable from @metamask/design-system-shared

Screenshots/Recordings

Before

TextVariant was a duplicated enum in both design-system-react and design-system-react-native src/types/index.ts.

After

TextVariant is a const object in @metamask/design-system-shared, re-exported through platform types/index.ts for backwards compatibility.

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 

- Add TextVariant const object to design-system-shared (ADR-0003)
  - Replaces the duplicated enum in React and React Native packages
  - Values are identical across platforms: display-lg, body-md, etc.
- Add InputPropsShared type to design-system-shared (ADR-0004)
  - Shared props: textVariant, isDisabled, isReadonly
  - Platform-specific: value (RN), isStateStylesDisabled (RN), twClassName (RN), className (React)
- Update React and React Native platform types/index.ts to re-export TextVariant from shared
- Update Text component files in both packages to import TextVariant from shared
- Update Input component, types, stories, and test files to use shared types

Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

📖 Storybook Preview

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.

1 participant