-
Notifications
You must be signed in to change notification settings - Fork 8
feat(design-system): setup Figma Code Connect CLI [AR-71339] #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iromanchuk-dn
merged 16 commits into
drivenets:main
from
iromanchuk-dn:AR-71339-setup-code-connect-cli-for-ds-status-badge-v-2
Jun 24, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ecf185b
feat(design-system): setup Figma Code Connect CLI [AR-71339]
iromanchuk-dn 98aed1d
changeset
iromanchuk-dn 6a43680
Exclude figma.ts files from knip
iromanchuk-dn 79fe199
dedupe lockfile esbuild resolution for vitest
iromanchuk-dn 8e360fc
Merge branch 'main' into AR-71339-setup-code-connect-cli-for-ds-statu…
iromanchuk-dn 60563b3
Merge branch 'main' into AR-71339-setup-code-connect-cli-for-ds-statu…
iromanchuk-dn 7edeebc
Remove changeset
iromanchuk-dn 3d5bcd5
Split action into 2 files; move to turbo tasks
iromanchuk-dn 9922459
exlude story files from code connect
iromanchuk-dn 2fc658b
Setup Code Connect CLI for ds-button-v3
iromanchuk-dn b501151
Setup Code Connect CLI for ds-text-input
iromanchuk-dn 2e88b94
Setup Code Connect CLI for ds-modal
iromanchuk-dn 5af9717
wip
StyleShit 9394e80
wip
StyleShit f6a4bfc
wip
StyleShit 2e9af54
Merge branch 'main' into AR-71339-setup-code-connect-cli-for-ds-statu…
iromanchuk-dn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Figma Code Connect Publish | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: '${{ github.workflow }} @ ${{ github.ref }}' | ||
| cancel-in-progress: false # Ensure that previous runs aren't cancelled and leave the publish in a broken state. | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish | ||
| runs-on: ubuntu-latest | ||
|
|
||
| if: github.repository_owner == 'drivenets' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout source code | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/install | ||
|
|
||
| - name: Publish | ||
| run: pnpm figma:publish | ||
| env: | ||
| FIGMA_ACCESS_TOKEN: ${{ secrets.FIGMA_ACCESS_TOKEN }} |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "codeConnect": { | ||
| "include": ["**/*.figma.ts"], | ||
| "importPaths": { | ||
| "src/components/*": "@drivenets/design-system" | ||
| }, | ||
| "label": "React", | ||
| "language": "tsx", | ||
| "parser": "react" | ||
| } | ||
| } | ||
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
46 changes: 46 additions & 0 deletions
46
packages/design-system/src/components/ds-button-v3/ds-button-v3.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=31065-2352 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-button-v3 | ||
| // component=DsButtonV3 | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const variant = instance.getEnum('Variant', { | ||
| primary: 'primary', | ||
| secondary: 'secondary', | ||
| tertiary: 'tertiary', | ||
| }); | ||
| const size = instance.getEnum('Size', { | ||
| tiny: 'tiny', | ||
| small: 'small', | ||
| medium: 'medium', | ||
| large: 'large', | ||
| }); | ||
| const colorVariant = instance.getEnum('Color', { default: 'default', error: 'error' }); | ||
| const isLight = instance.getEnum('light', { true: true, false: false }); | ||
| const color = isLight ? 'light' : colorVariant; | ||
| const disabled = instance.getEnum('State', { | ||
| default: false, | ||
| hover: false, | ||
| focus: false, | ||
| active: false, | ||
| disabled: true, | ||
| }); | ||
| const iconOnly = instance.getEnum('Icon', { 'icon-only': true, text: false }); | ||
|
|
||
| const structure = instance.findInstance('.button-structure', { traverseInstances: true }); | ||
| const showIcon = structure.type === 'INSTANCE' ? structure.getBoolean('Show icon') : false; | ||
|
|
||
| const labelNode = instance.findText('Button', { traverseInstances: true }); | ||
| const label = labelNode.type === 'TEXT' ? labelNode.textContent : 'Button'; | ||
|
|
||
| export default { | ||
| example: iconOnly | ||
| ? figma.code`<DsButtonV3 variant="${variant}" color="${color}" size="${size}" ${disabled ? 'disabled' : ''} icon="check_circle" aria-label="${label}" />` | ||
| : showIcon | ||
| ? figma.code`<DsButtonV3 variant="${variant}" color="${color}" size="${size}" ${disabled ? 'disabled' : ''} icon="check_circle">${label}</DsButtonV3>` | ||
| : figma.code`<DsButtonV3 variant="${variant}" color="${color}" size="${size}" ${disabled ? 'disabled' : ''}>${label}</DsButtonV3>`, | ||
| imports: ["import { DsButtonV3 } from '@drivenets/design-system'"], | ||
| id: 'ds-button-v3', | ||
| metadata: { nestable: true }, | ||
| }; |
18 changes: 18 additions & 0 deletions
18
packages/design-system/src/components/ds-modal/figma/ds-modal-content.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34877-158343 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-modal | ||
| // component=DsModal.Body | ||
| // | ||
| // `DAP_modal-content_v02` maps to `DsModal.Body`. Its freeform `Modal content slot` | ||
| // becomes the body children. | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const content = instance.getSlot('Modal content slot'); | ||
|
|
||
| export default { | ||
| example: figma.code`<DsModal.Body>${content}</DsModal.Body>`, | ||
| imports: ["import { DsModal } from '@drivenets/design-system'"], | ||
| id: 'ds-modal-content', | ||
| metadata: { nestable: true }, | ||
| }; |
19 changes: 19 additions & 0 deletions
19
packages/design-system/src/components/ds-modal/figma/ds-modal-footer.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=32014-16402 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-modal | ||
| // component=DsModal.Footer | ||
| // | ||
| // `DAP_modal-footer_v02` maps to `DsModal.Footer` > `DsModal.Actions`. The | ||
| // `right side buttons` slot resolves its `DAP_Button_v03` instances via the | ||
| // existing `ds-button-v3` Code Connect. | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const rightButtons = instance.getSlot('right side buttons'); | ||
|
|
||
| export default { | ||
| example: figma.code`<DsModal.Footer><DsModal.Actions>${rightButtons}</DsModal.Actions></DsModal.Footer>`, | ||
| imports: ["import { DsModal } from '@drivenets/design-system'"], | ||
| id: 'ds-modal-footer', | ||
| metadata: { nestable: true }, | ||
| }; |
21 changes: 21 additions & 0 deletions
21
packages/design-system/src/components/ds-modal/figma/ds-modal-header.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=32030-12809 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-modal | ||
| // component=DsModal.Header | ||
| // | ||
| // `DAP_modal-header_v02` maps to the composed `DsModal.Header` (title + close | ||
| // trigger). The `Type=drill-down` variant (back breadcrumb) and the optional | ||
| // booleans (status badge, description, tags, etc.) have no code-component prop and | ||
| // are omitted. | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const titleNode = instance.findText('Left side', { traverseInstances: true }); | ||
| const title = titleNode.type === 'TEXT' ? titleNode.textContent : 'Modal title'; | ||
|
|
||
| export default { | ||
| example: figma.code`<DsModal.Header><DsModal.Title>${title}</DsModal.Title><DsModal.CloseTrigger /></DsModal.Header>`, | ||
| imports: ["import { DsModal } from '@drivenets/design-system'"], | ||
| id: 'ds-modal-header', | ||
| metadata: { nestable: true }, | ||
| }; |
36 changes: 36 additions & 0 deletions
36
packages/design-system/src/components/ds-modal/figma/ds-modal.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34877-158966 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-modal | ||
| // component=DsModal | ||
| // | ||
| // `DAP_modal_v02` is the full modal. It composes the header, content, and footer | ||
| // parts, each of which has its own Code Connect template; resolve them dynamically | ||
| // so swapped variants stay in sync. The `Type` variant (confirmation/form) has no | ||
| // `DsModal` prop equivalent — both render the same composition. | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const header = instance.findInstance('DAP_modal-header_v02', { traverseInstances: true }); | ||
| let headerCode: figma.ResultSection[] | undefined; | ||
| if (header.type === 'INSTANCE') { | ||
| headerCode = header.executeTemplate().example; | ||
| } | ||
|
|
||
| const content = instance.findInstance('DAP_modal-content_v02', { traverseInstances: true }); | ||
| let contentCode: figma.ResultSection[] | undefined; | ||
| if (content.type === 'INSTANCE') { | ||
| contentCode = content.executeTemplate().example; | ||
| } | ||
|
|
||
| const footer = instance.findInstance('DAP_modal-footer_v02', { traverseInstances: true }); | ||
| let footerCode: figma.ResultSection[] | undefined; | ||
| if (footer.type === 'INSTANCE') { | ||
| footerCode = footer.executeTemplate().example; | ||
| } | ||
|
|
||
| export default { | ||
| example: figma.code`<DsModal open columns={6} onOpenChange={() => {}}>${headerCode}${contentCode}${footerCode}</DsModal>`, | ||
| imports: ["import { DsModal } from '@drivenets/design-system'"], | ||
| id: 'ds-modal', | ||
| metadata: { nestable: false }, | ||
| }; |
41 changes: 41 additions & 0 deletions
41
packages/design-system/src/components/ds-status-badge-v2/ds-status-badge-v2.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34428-16204 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-status-badge-v2 | ||
| // component=DsStatusBadgeV2 | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const phase = instance.getEnum('status', { | ||
| 'not-started': 'not-started', | ||
| temporary: 'temporary', | ||
| 'in-review': 'in-review', | ||
| pending: 'pending', | ||
| active: 'active', | ||
| execution: 'execution', | ||
| 'result-succeeded': 'result-succeeded', | ||
| 'result-warning': 'result-warning', | ||
| 'result-failed': 'result-failed', | ||
| deprecated: 'deprecated', | ||
| }); | ||
| const variant = instance.getEnum('variant', { primary: 'primary', secondary: 'secondary' }); | ||
| const size = instance.getEnum('Size', { medium: 'medium', small: 'small' }); | ||
| const structure = instance.getEnum('structure', { | ||
| 'icon+text': 'icon+text', | ||
| 'icon-only': 'icon-only', | ||
| 'text-only': 'text-only', | ||
| }); | ||
|
|
||
| const labelNode = instance.findText('Active', { traverseInstances: true }); | ||
| const label = labelNode.type === 'TEXT' ? labelNode.textContent : 'Active'; | ||
|
|
||
| export default { | ||
| example: | ||
| structure === 'icon-only' | ||
|
iromanchuk-dn marked this conversation as resolved.
|
||
| ? figma.code`<DsStatusBadgeV2 phase="${phase}" label="${label}" variant="${variant}" size="${size}" iconOnly />` | ||
| : structure === 'text-only' | ||
| ? figma.code`<DsStatusBadgeV2 phase="${phase}" label="${label}" variant="${variant}" size="${size}" icon={null} />` | ||
| : figma.code`<DsStatusBadgeV2 phase="${phase}" label="${label}" variant="${variant}" size="${size}" />`, | ||
| imports: ["import { DsStatusBadgeV2 } from '@drivenets/design-system'"], | ||
| id: 'ds-status-badge-v2', | ||
|
iromanchuk-dn marked this conversation as resolved.
|
||
| metadata: { nestable: true }, | ||
| }; | ||
54 changes: 54 additions & 0 deletions
54
packages/design-system/src/components/ds-text-input/ds-text-input.figma.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=13346-18325 | ||
| // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-text-input | ||
| // component=DsTextInput | ||
| // | ||
| // The Figma component `DAP_input_v01` is a single multi-type input. Its `Type` | ||
| // variant selects which code component to render: | ||
| // Number -> DsNumberInput | ||
| // Password -> DsPasswordInput | ||
| // Standard/Error/Read -> DsTextInput | ||
| import figma from 'figma'; | ||
|
|
||
| const instance = figma.selectedInstance; | ||
|
|
||
| const type = instance.getEnum('Type', { | ||
| Standard: 'standard', | ||
| Error: 'error', | ||
| 'Read Only': 'readOnly', | ||
| Number: 'number', | ||
| Password: 'password', | ||
| }); | ||
|
|
||
| const size = instance.getEnum('Size', { | ||
| Small: 'small', | ||
| Default: 'default', | ||
| Large: 'default', | ||
| }); | ||
|
|
||
| const state = instance.getEnum('State', { | ||
| Default: 'default', | ||
| Hover: 'hover', | ||
| 'Focus/ Typing': 'focus', | ||
| Disabled: 'disabled', | ||
| 'Read only': 'readOnly', | ||
| }); | ||
|
|
||
| const disabled = state === 'disabled'; | ||
| const readOnly = type === 'readOnly' || state === 'readOnly'; | ||
|
|
||
| const sizeAttr = size === 'small' ? 'size="small"' : ''; | ||
|
|
||
| const componentName = | ||
| type === 'number' ? 'DsNumberInput' : type === 'password' ? 'DsPasswordInput' : 'DsTextInput'; | ||
|
|
||
| export default { | ||
| example: | ||
| type === 'number' | ||
| ? figma.code`<DsNumberInput ${sizeAttr} ${disabled ? 'disabled' : ''} />` | ||
| : type === 'password' | ||
| ? figma.code`<DsPasswordInput ${sizeAttr} ${disabled ? 'disabled' : ''} />` | ||
| : figma.code`<DsTextInput ${sizeAttr} ${disabled ? 'disabled' : ''} ${readOnly ? 'readOnly' : ''} />`, | ||
| imports: [`import { ${componentName} } from '@drivenets/design-system'`], | ||
| id: 'ds-text-input', | ||
| metadata: { nestable: true }, | ||
| }; |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.