feat(DSYS-488): Migrate Input to ADR-0003 and ADR-0004#1043
Draft
cursor[bot] wants to merge 1 commit intomainfrom
Draft
feat(DSYS-488): Migrate Input to ADR-0003 and ADR-0004#1043cursor[bot] wants to merge 1 commit intomainfrom
cursor[bot] wants to merge 1 commit intomainfrom
Conversation
- 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>
Contributor
📖 Storybook Preview |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR migrates the
Inputcomponent 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 duplicatedenum TextVariantin both platform packages to a singleconstobject 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,isReadonlyUpdated platform packages
@metamask/design-system-reactand@metamask/design-system-react-native:enum TextVariantfromsrc/types/index.ts— now re-exported from sharedInput.types.tsimportsInputPropsSharedfrom shared and extends with platform-specific props (className/twClassName,value,isStateStylesDisabled)Input,Text, and related component files updated to importTextVariantfrom@metamask/design-system-sharedinstead of local../../typesPlatform-specific props remain in platform packages
className,stylevalue(controlled),isStateStylesDisabled,twClassNameRelated issues
Fixes: DSYS-488
Manual testing steps
yarn build— all packages build successfullyyarn test— all tests pass with 100% coverage on changed componentsTextVariantis importable from@metamask/design-system-sharedInputPropsSharedis importable from@metamask/design-system-sharedScreenshots/Recordings
Before
TextVariantwas a duplicatedenumin bothdesign-system-reactanddesign-system-react-nativesrc/types/index.ts.After
TextVariantis aconstobject in@metamask/design-system-shared, re-exported through platformtypes/index.tsfor backwards compatibility.Pre-merge author checklist
Pre-merge reviewer checklist