fix: figma code connect mappings#1109
Conversation
📖 Storybook Preview |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: RN TextButton figma file imports removed
TextButtonSizetype- Updated RN TextButton Code Connect to remove undefined TextButtonSize and invalid props, mapping Figma size to TextVariant via variant and simplifying the example to match the text-only API.
Or push these changes by commenting:
@cursor push 70cd03db96
Preview (70cd03db96)
diff --git a/packages/design-system-react-native/src/components/TextButton/TextButton.figma.tsx b/packages/design-system-react-native/src/components/TextButton/TextButton.figma.tsx
--- a/packages/design-system-react-native/src/components/TextButton/TextButton.figma.tsx
+++ b/packages/design-system-react-native/src/components/TextButton/TextButton.figma.tsx
@@ -1,14 +1,11 @@
// import figma needs to remain as figma otherwise it breaks code connect
// eslint-disable-next-line import-x/no-named-as-default
import figma from '@figma/code-connect';
+import { TextVariant } from '@metamask/design-system-shared';
import React from 'react';
-import { IconName } from '../Icon';
-
import { TextButton } from './TextButton';
-import { TextButtonSize } from '.';
-
/**
* -- This file was auto-generated by Code Connect --
* React Native implementation of TextButton component
@@ -23,38 +20,14 @@
'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-MMDS-Components?node-id=1%3A398',
{
props: {
- size: figma.enum('size', {
- BodyMd: TextButtonSize.BodyMd,
- BodySm: TextButtonSize.BodySm,
+ // Map Figma "size" variant to Text variant used by RN TextButton
+ variant: figma.enum('size', {
+ BodyMd: TextVariant.BodyMd,
+ BodySm: TextVariant.BodySm,
}),
- isDisabled: figma.boolean('isDisabled'),
- isInverse: figma.boolean('isInverse'),
- startIconName: figma.boolean('startIcon (Figma Only)', {
- true: IconName.Add,
- false: undefined,
- }),
- endIconName: figma.boolean('endIcon (Figma Only)', {
- true: IconName.Add,
- false: undefined,
- }),
},
- example: ({
- size,
- isDisabled,
- isInverse,
- startIconName,
- endIconName,
- ...props
- }) => (
- <TextButton
- size={size}
- isDisabled={isDisabled}
- isInverse={isInverse}
- startIconName={startIconName}
- endIconName={endIconName}
- {...props}
- onPress={() => undefined}
- >
+ example: ({ variant, ...props }) => (
+ <TextButton variant={variant} {...props} onPress={() => undefined}>
Text Button
</TextButton>
),You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit ffeb383. Configure here.
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-WIP--MMDS-Components?node-id=310%3A2005', | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-MMDS-Components?node-id=310%3A2005', | ||
| { | ||
| props: { |
There was a problem hiding this comment.
Removing isReverse here matches the current published Figma AvatarGroup component, which no longer exposes an isReverse property in its variant set. @amandaye0h @brianacnguyen if reversed stacking is no longer supported on the design side, we should consider deprecating the code prop as follow-up.
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-WIP--MMDS-Components?node-id=310%3A2005', | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-MMDS-Components?node-id=310%3A2005', | ||
| { | ||
| props: { |
There was a problem hiding this comment.
Removing isReverse here matches the current published Figma AvatarGroup component, which no longer exposes an isReverse property in its variant set. @amandaye0h @brianacnguyen if reversed stacking is no longer supported on the design side, we should consider deprecating the code prop as follow-up.
📖 Storybook Preview |
35595ba to
f1c61e2
Compare
📖 Storybook Preview |
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-WIP--MMDS-Components?node-id=1%3A398', | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-MMDS-Components?node-id=1%3A398', | ||
| { | ||
| props: { |
There was a problem hiding this comment.
RN TextButton was intentionally simplified in an earlier breaking refactor, so this mapping only keeps the subset that still exists on the native component. We leave the broader React/Figma TextButton alignment for a follow-up instead of making RN Code Connect claim support for inverse, disabled, or icon props it no longer has.
| figma.connect( | ||
| ButtonIcon, | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-WIP--MMDS-Components?node-id=1%3A2860', | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-MMDS-Components?node-id=1%3A2860', |
There was a problem hiding this comment.
This points at the MMDS branch node where ButtonIcon was migrated from separate isInverse and isFloating properties to a single variant axis. We should merge that Figma branch change as well so the live component model stays aligned with the code mapping in this file.
| figma.connect( | ||
| ButtonIcon, | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-WIP--MMDS-Components?node-id=1%3A2860', | ||
| 'https://www.figma.com/design/1D6tnzXqWgnUC3spaAOELN/%F0%9F%A6%8A-MMDS-Components?node-id=1%3A2860', |
There was a problem hiding this comment.
This points at the MMDS branch node where ButtonIcon was migrated from separate isInverse and isFloating properties to a single variant axis. We should merge that Figma branch change as well so the live component model stays aligned with the code mapping in this file.
## Release 37.0.0 This release focuses on consumer-facing changelog cleanup for the packages being published, plus migration-guide coverage for the React Native `TextField` API changes included in this release. ### 📦 Package Versions - `@metamask/design-system-shared`: **0.15.0** - `@metamask/design-system-react`: **0.20.0** - `@metamask/design-system-react-native`: **0.22.0** ### 🔄 Shared Type Updates (0.15.0) #### Shared type additions ([#1034](#1034), [#1038](#1038), [#1081](#1081)) **What Changed:** - Added shared `ButtonBaseSize`, `ButtonSize`, `ButtonHeroSize`, `ButtonVariant`, `ButtonBasePropsShared`, and `ButtonPropsShared` - Added shared `ButtonIconSize`, `ButtonIconVariant`, and `ButtonIconPropsShared` - Added shared `TextFieldPropsShared` for the controlled text-field contract used across platforms **Impact:** - Continues ADR-0003 and ADR-0004 migration toward shared const-object plus string-union exports - Gives React and React Native one shared source of truth for these component contracts ### 🌐 React Web Updates (0.20.0) #### Changed - **BREAKING:** Updated `Button`, `ButtonBase`, and `ButtonHero` size and variant exports to use shared const-object + string-union types rather than platform-local enum-based definitions ([#1034](#1034)) - No migration required for typical usage; continue importing from `@metamask/design-system-react` as before - **BREAKING:** Updated `ButtonIconSize` and `ButtonIconVariant` to use shared const-object + string-union types rather than platform-local enum-based definitions ([#1038](#1038)) - No migration required for typical usage; continue importing from `@metamask/design-system-react` as before - Updated Figma Code Connect to the live `MMDS Components` file and aligned `ButtonIcon` and `TextButton` mappings with the current component APIs shown in Dev Mode ([#1109](#1109)) - Expanded the `TextButton` migration guide for extension consumers replacing `ButtonLink` and `ButtonVariant.Link` with the current design-system APIs ([#1098](#1098)) ### 📱 React Native Updates (0.22.0) #### Changed - **BREAKING:** Updated `Button`, `ButtonBase`, and `ButtonHero` size and variant exports to use shared const-object + string-union types rather than platform-local enum-based definitions ([#1034](#1034)) - No migration required for typical usage; continue importing from `@metamask/design-system-react-native` as before - **BREAKING:** Updated `ButtonIconSize` and `ButtonIconVariant` to use shared const-object + string-union types rather than platform-local enum-based definitions ([#1038](#1038)) - No migration required for typical usage; continue importing from `@metamask/design-system-react-native` as before - **BREAKING:** `TextField` and `TextFieldSearch` now use a root `Box`/`View`, require native `TextInput` props under `inputProps`, rename `isReadonly` to `isReadOnly`, and use `inputRef` for the inner input ref ([#1081](#1081)) - Updated Figma Code Connect to the live `MMDS Components` file and aligned `ButtonIcon` and `TextButton` mappings with the current component APIs shown in Dev Mode ([#1109](#1109)) ###⚠️ Breaking Changes #### Shared button size and variant exports (Both Platforms) **What Changed:** - `ButtonVariant`, `ButtonBaseSize`, `ButtonSize`, `ButtonHeroSize`, `ButtonIconSize`, and `ButtonIconVariant` now come from shared ADR-0003/ADR-0004 definitions instead of platform-local enums - Runtime values and standard imports remain stable for typical usage **Impact:** - Affects TypeScript consumers that depended on enum-specific behavior rather than the exported members themselves #### React Native TextField prop layering (React Native) **What Changed:** - `TextField` and `TextFieldSearch` now treat the root as a `Box`/`View` - Native `TextInput` props must move under `inputProps` - `isReadonly` is renamed to `isReadOnly` - `ref` now targets the outer container and `inputRef` targets the inner `TextInput` **Migration:** ```tsx // Before (0.21.0) <TextField value={query} onChangeText={setQuery} placeholder="Search" keyboardType="default" secureTextEntry onFocus={handleFocus} /> // After (0.22.0) <TextField value={query} onChangeText={setQuery} placeholder="Search" onFocus={handleFocus} inputProps={{ keyboardType: 'default', secureTextEntry: true, }} /> ``` **Impact:** - Affects React Native consumers passing `TextInput` props or pressable-only props at the top level of `TextField` / `TextFieldSearch` See migration guides for complete instructions: - [React Native Migration Guide](./packages/design-system-react-native/MIGRATION.md#from-version-0210-to-0220) ### ✅ Checklist - [x] Changelogs updated with human-readable descriptions - [x] Changelog validation passed (`yarn changelog:validate`) - [x] Version bumps follow semantic versioning - [x] design-system-shared: minor (`0.14.0` → `0.15.0`) - shared type additions - [x] design-system-react: minor (`0.19.0` → `0.20.0`) - includes breaking changes under pre-1.0 semver - [x] design-system-react-native: minor (`0.21.0` → `0.22.0`) - includes breaking changes under pre-1.0 semver - [x] Breaking changes documented with migration guidance where needed - [x] Migration guides updated with before/after examples for the React Native `TextField` changes - [x] PR references included in changelog entries ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] 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 where migration guidance is required - [ ] All unreleased changes are accounted for in changelogs <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Release-only change: bumps package versions and updates changelog/migration documentation without modifying runtime code. Low risk aside from potential downstream confusion if documented breaking changes don’t match what was actually published. > > **Overview** > Bumps the monorepo release to `37.0.0` and increments package versions for `@metamask/design-system-shared` (`0.15.0`), `@metamask/design-system-react` (`0.20.0`), and `@metamask/design-system-react-native` (`0.22.0`). > > Updates consumer-facing release notes: adds new changelog entries (including documented *breaking* type-export contract changes and RN `TextField` API migration details), refreshes the RN migration guide section for `0.21.0` → `0.22.0`, and updates changelog compare links accordingly. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2140b12. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Description
This updates the Figma Code Connect configuration to point at the live
🦊 MMDS Componentsfile instead of the deprecated WIP file and fixes a small set of stale prop mappings that no longer matched the current Figma component schemas.The main fixes are:
.figma.tsxfiles and bothfigma.config.jsonfiles to🦊 MMDS ComponentsButtonIconto a single Figmavariantaxis (Default/Filled/Floating) and update React + React Native Code Connect to use that enum directlyisReversemapping fromAvatarGroupTextButtonmapping to the subset the current RN component actually supportsFigma branch reference
Figma branch used for validation and direct component edits:
Direct Figma changes made for reference:
ButtonIcon(node-id=1:2860): migrated the component set fromisInverse+isFloatingvariant properties to a singlevariantproperty withDefault,Filled, andFloatingText Button(node-id=1:398): renamed the component set fromButtonTexttoText ButtonRelated issues
Fixes:
Manual testing steps
yarn figma:connect:publish:dry-runyarn figma:connect:publish🦊 MMDS Componentsin Figma Dev Mode and verify connected components show published React and React Native Code Connect docsScreenshots/Recordings
Before
Not included. Validation was failing because several Code Connect mappings targeted stale file URLs or stale component properties.
After
Not included.
yarn figma:connect:publish:dry-runpasses for both React and React Native, andyarn figma:connect:publishsuccessfully uploads both platforms to🦊 MMDS Components.Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk: updates Code Connect configuration/docs and a few component prop mappings, with no runtime production logic changes beyond Figma snippet generation.
Overview
Repoints all Figma Code Connect URLs (docs, both
figma.config.jsonfiles, and multiple.figma.tsxconnectors) from the deprecated WIP file to the live🦊 MMDS Componentsdesign file.Refreshes a few stale prop mappings to match current component schemas: removes
AvatarGroup’sisReversemapping, updatesButtonIconto use a singlevariantenum (Default/Filled/Floating), and narrows React NativeTextButtonmapping to the supported text-size variants (wiring it throughvariant).Reviewed by Cursor Bugbot for commit f1c61e2. Bugbot is set up for automated code reviews on this repo. Configure here.