-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add figma code connect (#16730)
* feat: add figma code connect (#16348) * chore: update gitignore * feat: add figma code connect * chore: update readme * feat(code-connect): update Link and Notification * feat: code connect updates * chore: update disclaimer text * feat: add checkbox * feat: contentswitcher * feat: add breadcrumb checkbox and grid * feat: codesnippet * feat: wip tooltip and contained list * chore: update to 0.1.2 * chore: add code comments to accordion * docs: update readma * feat(code-connect): connect toggle * feat(code-connect): connect NumberInput * chore: add basic config file * chore: ignore ts and exclude from ts build * chore: update config file * chore: update readme * chore: fix versions from merge conflict * chore: yarn dedupe * chore: fix yarn * chore: yarn * chore: yarn * chore: yarn dedupe
- Loading branch information
1 parent
e582548
commit 47b909e
Showing
106 changed files
with
1,903 additions
and
218 deletions.
There are no files selected for viewing
This file contains 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,13 @@ | ||
on: | ||
push: | ||
paths: | ||
- src/packages/react/code-connect/**/*.figma.tsx | ||
branches: | ||
- main | ||
|
||
jobs: | ||
code-connect: | ||
name: Code Connect | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: npx figma connect publish |
This file contains 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 |
---|---|---|
|
@@ -57,3 +57,6 @@ package-lock.json | |
|
||
# Playwright | ||
.playwright | ||
|
||
# Local token | ||
.env |
Binary file removed
BIN
-9.17 KB
.yarn/cache/@babel-code-frame-npm-7.22.13-2782581d20-bf6ae6ba3a.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-9.47 KB
.yarn/cache/@babel-compat-data-npm-7.22.9-f9e02d51b9-6797f59857.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-21.7 KB
.yarn/cache/@babel-helper-compilation-targets-npm-7.22.9-b4473889ca-779510e4c2.zip
Binary file not shown.
Binary file added
BIN
+21.8 KB
.yarn/cache/@babel-helper-compilation-targets-npm-7.24.7-b6fcad7a45-8f8bc89af7.zip
Binary file not shown.
Binary file removed
BIN
-4.34 KB
.yarn/cache/@babel-helper-environment-visitor-npm-7.22.5-7bc52eec61-248532077d.zip
Binary file not shown.
Binary file added
BIN
+4.37 KB
.yarn/cache/@babel-helper-environment-visitor-npm-7.24.7-9a965bf523-079d86e657.zip
Binary file not shown.
Binary file removed
BIN
-8.75 KB
.yarn/cache/@babel-helper-function-name-npm-7.22.5-8a1a69b63d-6d02e304a4.zip
Binary file not shown.
Binary file added
BIN
+8.85 KB
.yarn/cache/@babel-helper-function-name-npm-7.24.7-4f88fa6768-2ceb3d9b2b.zip
Binary file not shown.
Binary file removed
BIN
-4.5 KB
.yarn/cache/@babel-helper-hoist-variables-npm-7.22.5-6db3192347-394ca191b4.zip
Binary file not shown.
Binary file added
BIN
+4.5 KB
.yarn/cache/@babel-helper-hoist-variables-npm-7.24.7-3d1fb54723-6cfdcf2289.zip
Binary file not shown.
Binary file removed
BIN
-16 KB
.yarn/cache/@babel-helper-module-imports-npm-7.22.5-399b6063db-d8296447c0.zip
Binary file not shown.
Binary file added
BIN
+18.2 KB
.yarn/cache/@babel-helper-module-imports-npm-7.24.7-f60e66adbf-df8bfb2bb1.zip
Binary file not shown.
Binary file removed
BIN
-41.9 KB
.yarn/cache/@babel-helper-module-transforms-npm-7.22.9-dfa9ef05d1-80244f45e3.zip
Binary file not shown.
Binary file added
BIN
+45.4 KB
.yarn/cache/@babel-helper-module-transforms-npm-7.24.7-34219c1829-4f2b232bf6.zip
Binary file not shown.
Binary file removed
BIN
-5.9 KB
.yarn/cache/@babel-helper-simple-access-npm-7.22.5-0a3f578780-7d5430eecf.zip
Binary file not shown.
Binary file added
BIN
+5.91 KB
.yarn/cache/@babel-helper-simple-access-npm-7.24.7-beddd00b0e-5083e19018.zip
Binary file not shown.
Binary file removed
BIN
-5.25 KB
.yarn/cache/@babel-helper-split-export-declaration-npm-7.22.6-e723505aef-e141cace58.zip
Binary file not shown.
Binary file added
BIN
+5.31 KB
.yarn/cache/@babel-helper-split-export-declaration-npm-7.24.7-77b1fc1a1c-ff04a30716.zip
Binary file not shown.
Binary file removed
BIN
-9.82 KB
.yarn/cache/@babel-helper-string-parser-npm-7.22.5-448ff0e489-7f275a7f1a.zip
Binary file not shown.
Binary file added
BIN
+9.92 KB
.yarn/cache/@babel-helper-string-parser-npm-7.24.7-560b175e3f-603d8d962b.zip
Binary file not shown.
Binary file removed
BIN
-17.5 KB
.yarn/cache/@babel-helper-validator-identifier-npm-7.22.20-18305bb306-df882d2675.zip
Binary file not shown.
Binary file added
BIN
+17.7 KB
.yarn/cache/@babel-helper-validator-identifier-npm-7.24.7-748889c8d2-86875063f5.zip
Binary file not shown.
Binary file removed
BIN
-7.14 KB
.yarn/cache/@babel-helper-validator-option-npm-7.22.5-eaf22b24ab-bbeca8a85e.zip
Binary file not shown.
Binary file added
BIN
+7.22 KB
.yarn/cache/@babel-helper-validator-option-npm-7.24.7-6bf4b631c7-9689166bf3.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-22.4 KB
.yarn/cache/@jridgewell-gen-mapping-npm-0.3.3-1815eba94c-072ace159c.zip
Binary file not shown.
Binary file added
BIN
+23 KB
.yarn/cache/@jridgewell-gen-mapping-npm-0.3.5-d8b85ebeaf-81587b3c4d.zip
Binary file not shown.
Binary file removed
BIN
-17.9 KB
.yarn/cache/@jridgewell-resolve-uri-npm-3.1.0-6ff2351e61-320ceb37af.zip
Binary file not shown.
Binary file added
BIN
+17.5 KB
.yarn/cache/@jridgewell-resolve-uri-npm-3.1.2-5bc4245992-97106439d7.zip
Binary file not shown.
Binary file removed
BIN
-8.65 KB
.yarn/cache/@jridgewell-set-array-npm-1.1.2-45b82d7fb6-69a84d5980.zip
Binary file not shown.
Binary file added
BIN
+8.72 KB
.yarn/cache/@jridgewell-set-array-npm-1.2.1-2312928209-832e513a85.zip
Binary file not shown.
Binary file removed
BIN
-13.4 KB
.yarn/cache/@jridgewell-sourcemap-codec-npm-1.4.14-f5f0630788-26e768fae6.zip
Binary file not shown.
Binary file removed
BIN
-44.4 KB
.yarn/cache/@jridgewell-trace-mapping-npm-0.3.18-cd96571385-f4fabdddf8.zip
Binary file not shown.
Binary file added
BIN
+45.6 KB
.yarn/cache/@jridgewell-trace-mapping-npm-0.3.25-c076fd2279-dced32160a.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+4.29 KB
.yarn/cache/@storybook-client-logger-npm-7.6.19-6ae88c3561-140ea57ea5.zip
Binary file not shown.
Binary file added
BIN
+25.4 KB
.yarn/cache/@storybook-core-events-npm-7.6.19-3894c301ac-bbf856ee35.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+13.2 KB
.yarn/cache/@storybook-csf-tools-npm-7.6.19-b014c5f562-ef616c8df2.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-38.4 KB
.yarn/cache/electron-to-chromium-npm-1.4.756-60988025f5-fb3dfaf729.zip
Binary file not shown.
Binary file added
BIN
+39.1 KB
.yarn/cache/electron-to-chromium-npm-1.4.796-f75cc49719-af3c22d0cb.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+3.65 KB
...olors-npm-1.0.0-d81e0b1927-a2e8092dd8.zip → ...olors-npm-1.0.1-39442f3da8-fa68166d1f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-6.75 KB
.yarn/cache/update-browserslist-db-npm-1.0.15-7a2f8a8231-6800bfac69.zip
Binary file not shown.
Binary file added
BIN
+7.45 KB
.yarn/cache/update-browserslist-db-npm-1.0.16-ca365328e3-071bf0b2fb.zip
Binary file not shown.
This file contains 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": ["packages/react/code-connect/**"], | ||
"react": { | ||
"importPaths": { | ||
"packages/react/src/*": "@carbon/react" | ||
}, | ||
"paths": {} | ||
} | ||
} | ||
} |
This file contains 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,30 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @ts-nocheck | ||
import React from 'react'; | ||
import { Accordion } from '@carbon/react'; | ||
import figma from '@figma/code-connect'; | ||
|
||
figma.connect( | ||
Accordion, | ||
'https://www.figma.com/file/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?type=design&node-id=2490-17019&mode=design&t=0hF8pirV0i9mofd1-4', | ||
{ | ||
props: { | ||
// missing props, set on Accordion item within Figma | ||
// size | ||
// isFlush | ||
// align | ||
children: figma.children(['Accordion item']), | ||
}, | ||
example: ({ children }) => ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<Accordion>{children}</Accordion> | ||
), | ||
} | ||
); |
70 changes: 70 additions & 0 deletions
70
packages/react/code-connect/Accordion/AccordionItem.figma.tsx
This file contains 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,70 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @ts-nocheck | ||
import React from 'react'; | ||
import { AccordionItem } from '@carbon/react'; | ||
import figma from '@figma/code-connect'; | ||
|
||
figma.connect( | ||
AccordionItem, | ||
'https://www.figma.com/file/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?type=design&node-id=2154-8478&mode=design&t=0hF8pirV0i9mofd1-4', | ||
{ | ||
props: { | ||
title: figma.string('Title text'), | ||
disabled: figma.enum('State', { | ||
Disabled: true, | ||
}), | ||
open: figma.boolean('Expanded'), | ||
content: figma.string('Content text'), | ||
children: figma.instance('Swap slot'), | ||
// Props below are on accordion item in Figma and accordion in React | ||
// size: figma.enum('Size', { | ||
// Large: 'lg', | ||
// Medium: 'md', | ||
// Small: 'sm', | ||
// }), | ||
// isFlush: figma.boolean('Flush'), | ||
// align: figma.enum('Alignment', { | ||
// Left: 'start', | ||
// }), | ||
}, | ||
example: ({ | ||
title, | ||
disabled, | ||
open, | ||
content, | ||
children, | ||
// size, needs to be set on Accordion | ||
// isFlush, needs to be set on Accordion | ||
// align, needs to be set on Accordion | ||
}) => ( | ||
<AccordionItem title={title} disabled={disabled} open={open}> | ||
<p>{content}</p> | ||
{children} | ||
</AccordionItem> | ||
), | ||
} | ||
); | ||
|
||
// figma.connect( | ||
// AccordionSkeleton, | ||
// 'https://www.figma.com/file/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?type=design&node-id=14032-290635&mode=dev', | ||
// { | ||
// variant: { State: 'Skeleton' }, | ||
// props: { | ||
// open: figma.boolean('Expanded'), | ||
// isFlush: figma.boolean('Flush'), | ||
// align: figma.enum('Alignment', { | ||
// Left: 'start', | ||
// }), | ||
// }, | ||
// example: ({ size, hideLabel }) => { | ||
// return <AccordionSkeleton align={align} />; | ||
// }, | ||
// } | ||
// ); |
29 changes: 29 additions & 0 deletions
29
packages/react/code-connect/Breadcrumb/Breadcrumb.figma.tsx
This file contains 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,29 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @ts-nocheck | ||
import React from 'react'; | ||
import { Breadcrumb } from '@carbon/react'; | ||
import figma from '@figma/code-connect'; | ||
|
||
figma.connect( | ||
Breadcrumb, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3155-31030&t=U57NnoohldL54XAl-4', | ||
{ | ||
props: { | ||
//noTrailingSlash: needs to come from child item component in figma | ||
children: figma.children(['_Breadcrumb item']), | ||
}, | ||
example: ({ children }) => ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<Breadcrumb>{children}</Breadcrumb> | ||
), | ||
} | ||
); | ||
|
||
// BreadcrumbSkeleton missing from Figma, can only be set on individual items |
64 changes: 64 additions & 0 deletions
64
packages/react/code-connect/Breadcrumb/BreadcrumbItem.figma.tsx
This file contains 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,64 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @ts-nocheck | ||
import React from 'react'; | ||
import { BreadcrumbItem, OverflowMenu, OverflowMenuItem } from '@carbon/react'; | ||
import figma from '@figma/code-connect'; | ||
|
||
figma.connect( | ||
BreadcrumbItem, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3136-29234&t=U57NnoohldL54XAl-4', | ||
{ | ||
variant: { Type: 'Link' }, | ||
props: { | ||
// state: figma.enum('State', { // in react skeleton state replaces the entire Breadcrumb component , not BreadcrumbItem | ||
// Skeleton: 'skeleton', | ||
// }), | ||
children: figma.string('Link text'), | ||
}, | ||
example: ({ children }) => ( | ||
<BreadcrumbItem href="#">{children}</BreadcrumbItem> | ||
), | ||
} | ||
); | ||
|
||
figma.connect( | ||
BreadcrumbItem, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3136-29234&t=U57NnoohldL54XAl-4', | ||
{ | ||
variant: { Type: 'Current page' }, | ||
props: { | ||
children: figma.string('Link text'), | ||
isCurrentPage: figma.boolean('Current'), | ||
}, | ||
example: ({ children, isCurrentPage }) => ( | ||
<BreadcrumbItem isCurrentPage={isCurrentPage}>{children}</BreadcrumbItem> | ||
), | ||
} | ||
); | ||
|
||
figma.connect( | ||
BreadcrumbItem, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3136-29234&t=U57NnoohldL54XAl-4', | ||
{ | ||
variant: { Type: 'Overflow' }, | ||
props: { | ||
isCurrentPage: figma.boolean('Current'), | ||
}, | ||
example: ({ isCurrentPage }) => ( | ||
<BreadcrumbItem | ||
isCurrentPage={isCurrentPage} | ||
data-floating-menu-container> | ||
<OverflowMenu aria-label="Overflow menu in a breadcrumb"> | ||
<OverflowMenuItem itemText="Breadcrumb 3" /> | ||
<OverflowMenuItem itemText="Breadcrumb 4" /> | ||
</OverflowMenu> | ||
</BreadcrumbItem> | ||
), | ||
} | ||
); |
This file contains 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,94 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @ts-nocheck | ||
import React from 'react'; | ||
import { Button, ButtonSkeleton } from '@carbon/react'; | ||
import figma from '@figma/code-connect'; | ||
|
||
figma.connect( | ||
Button, | ||
'https://www.figma.com/file/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?type=design&node-id=1854-1776&mode=dev', | ||
{ | ||
props: { | ||
disabled: figma.enum('State', { | ||
Disabled: true, | ||
}), | ||
buttonText: figma.string('Button text'), | ||
kind: figma.enum('Style', { | ||
Primary: 'primary', | ||
Secondary: 'secondary', | ||
Tertiary: 'tertiary', | ||
Ghost: 'ghost', | ||
'Danger primary': 'danger', | ||
'Danger tertiary': 'danger--tertiary', | ||
'Danger ghost': 'danger--ghost', | ||
}), | ||
size: figma.enum('Size', { | ||
Large: 'lg', | ||
Medium: 'md', | ||
Small: 'sm', | ||
'Extra large': 'xl', | ||
'2x large': '2xl', | ||
}), | ||
isExpressive: figma.enum('Size', { | ||
Expressive: true, | ||
}), | ||
hasIconOnly: figma.enum('Type', { | ||
'Icon only': true, | ||
}), | ||
renderIcon: figma.instance('Swap icon'), | ||
}, | ||
example: ({ | ||
size, | ||
kind, | ||
isExpressive, | ||
hasIconOnly, | ||
renderIcon, | ||
disabled, | ||
buttonText, | ||
}) => { | ||
return ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<Button | ||
size={size} | ||
kind={kind} | ||
isExpressive={isExpressive} | ||
hasIconOnly={hasIconOnly} | ||
renderIcon={renderIcon} | ||
disabled={disabled}> | ||
{buttonText} | ||
</Button> | ||
); | ||
}, | ||
} | ||
); | ||
|
||
figma.connect( | ||
ButtonSkeleton, | ||
'https://www.figma.com/file/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?type=design&node-id=1854-1776&mode=dev', | ||
{ | ||
variant: { State: 'Skeleton' }, | ||
props: { | ||
size: figma.enum('Size', { | ||
Large: 'lg', | ||
Medium: 'md', | ||
Small: 'sm', | ||
'Extra large': 'xl', | ||
'2x large': '2xl', | ||
}), | ||
}, | ||
example: ({ size }) => { | ||
return ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<ButtonSkeleton size={size} /> | ||
); | ||
}, | ||
} | ||
); |
Oops, something went wrong.