Skip to content
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

fix(code-connect): update to v1 and fix bugs #16834

Merged
merged 22 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
df8a9f6
feat(code-connect): connect Select and FluidSelect
alisonjoseph Jun 13, 2024
942f642
chore: fix
alisonjoseph Jun 13, 2024
63faf34
feat(code-connect): connect select and radio button
alisonjoseph Jun 17, 2024
d298dbc
feat(code-connect): radio button and radio button group
alisonjoseph Jun 17, 2024
13babd3
chore: typo
alisonjoseph Jun 17, 2024
dd2b706
Merge branch 'main' into code-connect-select
alisonjoseph Jun 17, 2024
cef8c1a
feat(code-connect): connect search
alisonjoseph Jun 17, 2024
ccc61b2
chore: merge
alisonjoseph Jun 17, 2024
6a3b3dc
Update README.md
alisonjoseph Jun 17, 2024
003584e
fix(code-connect): update to v1 and fix bugs
alisonjoseph Jun 20, 2024
a18a60f
chore: merge
alisonjoseph Jun 20, 2024
2c79c43
Merge branch 'main' into code-connect-update
alisonjoseph Jun 20, 2024
bddfa83
fix: move code-connect to dev dependency
alisonjoseph Jun 21, 2024
05bbae7
chore: merge conflict
alisonjoseph Jun 21, 2024
9d40702
chore: yarn dedupe
alisonjoseph Jun 21, 2024
4daab5c
chore: merge conflicts
alisonjoseph Jun 24, 2024
21da20c
chore: match packages back to main
alisonjoseph Jun 24, 2024
87719e9
feat(code-connect): connect content-swticher
alisonjoseph Jun 25, 2024
93a2991
feat(code-connect): loading and inline loading
alisonjoseph Jun 25, 2024
a142da9
feat(code-connect): unorderedlist, orderedlist, listitem
alisonjoseph Jun 25, 2024
fdedcf6
feat(code-connect): progress bar
alisonjoseph Jun 25, 2024
d82ed6e
Merge branch 'main' into code-connect-update
alisonjoseph Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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.
13 changes: 6 additions & 7 deletions figma.config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"codeConnect": {
"include": ["packages/react/code-connect/**"],
"react": {
"importPaths": {
"packages/react/src/*": "@carbon/react"
},
"paths": {}
}
"parser": "react",
"importPaths": {
"packages/react/src/*": "@carbon/react"
},
"paths": {},
"include": ["packages/react/code-connect/**"]
}
}
24 changes: 18 additions & 6 deletions packages/react/code-connect/Accordion/Accordion.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,28 @@ figma.connect(
'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']),
accordionItem: figma.nestedProps('Accordion item', {
align: figma.enum('Alignment', {
Left: 'start',
}),
isFlush: figma.boolean('Flush'),
size: figma.enum('Size', {
Large: 'lg',
Medium: 'md',
Small: 'sm',
}),
}),
},
example: ({ children }) => (
example: ({ children, accordionItem }) => (
// 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>
<Accordion
size={accordionItem.size}
align={accordionItem.align}
isFlush={accordionItem.isFlush}>
{children}
</Accordion>
),
}
);
21 changes: 1 addition & 20 deletions packages/react/code-connect/Accordion/AccordionItem.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,8 @@ figma.connect(
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
}) => (
example: ({ title, disabled, open, content, children }) => (
<AccordionItem title={title} disabled={disabled} open={open}>
<p>{content}</p>
{children}
Expand Down
38 changes: 13 additions & 25 deletions packages/react/code-connect/CodeSnippet/CodeSnippet.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ figma.connect(
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4266-104960&t=cMvnFTYLPEhzhIpj-4',
{
props: {
children: figma.string('Code text'),
children: figma.textContent('node -v'),
},
example: ({ children }) => {
return (
Expand All @@ -49,14 +49,18 @@ figma.connect(
CodeSnippet,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4266-103999&t=cMvnFTYLPEhzhIpj-4',
{
example: () => (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below may be incomplete.
<CodeSnippet type="single" feedback="Copied to clipboard">
yarn add carbon-components@latest carbon-components-react@latest
@carbon/icons-react@latest carbon-icons@latest
</CodeSnippet>
),
props: {
children: figma.textContent('$ npm install --save carbon-components'),
},
example: ({ children }) => {
return (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below may be incomplete.
<CodeSnippet type="single" feedback="Copied to clipboard">
{children}
</CodeSnippet>
);
},
}
);

Expand Down Expand Up @@ -99,19 +103,3 @@ figma.connect(
),
}
);

// // Skeleton state (multiline only)
// figma.connect(
// CodeSnippetSkeleton,
// 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4257-168802&t=cMvnFTYLPEhzhIpj-4',
// {
// variant: { State: 'Skeleton' },
// example: () => {
// return (
// // Disclaimer: Code Connect is currently in beta and integration with Carbon
// // React is in an exploratory phase. Code sample below may be incomplete.
// <CodeSnippetSkeleton type="multi" />
// );
// },
// }
// );
Original file line number Diff line number Diff line change
@@ -1,32 +1,56 @@
/**
* 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 { ContentSwitcher } from './ContentSwitcher';
import { ContentSwitcher } from '@carbon/react';
import figma from '@figma/code-connect';

/**
* -- This file was auto-generated by `figma connect create` --
* `props` includes a mapping from Figma properties and variants to
* suggested values. You should update this to match the props of your
* code component, and update the `example` function to return the
* code example you'd like to see in Figma
*/

figma.connect(
ContentSwitcher,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=10151-402486&t=LoXqbMLZkoMgbrAS-4',
{
props: {
type: figma.enum('Type', {
Default: 'default',
'Icon only': 'icon-only',
children: figma.children(['_Content switcher text item']),
size: figma.enum('Size', {
Large: 'lg',
Medium: 'md',
Small: 'sm',
}),
},
example: ({ size, children }) => (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below may be incomplete.
<ContentSwitcher onChange={function noRefCheck() {}} size={size}>
{children}
</ContentSwitcher>
),
}
);

figma.connect(
ContentSwitcher,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=10151-402486&t=LoXqbMLZkoMgbrAS-4',
{
variant: { Type: 'Icon only' },
props: {
children: figma.children(['_Content switcher icon item']),
size: figma.enum('Size', {
Large: 'large',
Medium: 'medium',
Small: 'small',
Large: 'lg',
Medium: 'md',
Small: 'sm',
}),
disabled: figma.boolean('Disabled'),
},
example: () => <ContentSwitcher />,
example: ({ size, children }) => (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below may be incomplete.
<ContentSwitcher onChange={function noRefCheck() {}} size={size}>
{children}
</ContentSwitcher>
),
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* 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 { IconSwitch } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
IconSwitch,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=21988-280553&t=Y6lD1uj5Q0yszbgL-4',
{
props: {
children: figma.children('*'),
disabled: figma.enum('State', {
Disabled: true,
}),
},
example: ({ disabled, children }) => (
<IconSwitch disabled={disabled}>{children}</IconSwitch>
),
}
);
25 changes: 25 additions & 0 deletions packages/react/code-connect/ContentSwitcher/Switch.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* 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 { Switch } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
Switch,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=10151-402337&t=Y6lD1uj5Q0yszbgL-4',
{
props: {
text: figma.string('Label text'),
disabled: figma.enum('State', {
Disabled: true,
}),
},
example: ({ text, disabled }) => <Switch disabled={disabled} text={text} />,
}
);
5 changes: 3 additions & 2 deletions packages/react/code-connect/Grid/Grid.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ figma.connect(
Breakpoint7: 'breakpoint7',
Breakpoint8: 'breakpoint8',
}),
children: figma.children('*'),
},
example: () => (
example: ({ children }) => (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below is incomplete.
<Grid></Grid>
<Grid>{children}</Grid>
),
}
);
39 changes: 39 additions & 0 deletions packages/react/code-connect/List/List.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* 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 { UnorderedList, OrderedList } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
UnorderedList,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3284-27553&t=Y6lD1uj5Q0yszbgL-4',
{
variant: { Type: 'Unordered' },
props: { children: figma.children(['_List 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.
<UnorderedList>{children}</UnorderedList>
),
}
);

figma.connect(
OrderedList,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3284-27553&t=Y6lD1uj5Q0yszbgL-4',
{
variant: { Type: 'Ordered' },
props: { children: figma.children(['_List 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.
<OrderedList>{children}</OrderedList>
),
}
);
22 changes: 22 additions & 0 deletions packages/react/code-connect/List/ListItem.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* 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 { ListItem } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
ListItem,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3284-27542&t=Y6lD1uj5Q0yszbgL-4',
{
props: {
children: figma.string('List text'),
},
example: ({ children }) => <ListItem>{children}</ListItem>,
}
);
54 changes: 54 additions & 0 deletions packages/react/code-connect/Loading/Loading.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* 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 { Loading, InlineLoading } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
Loading,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3238-28455&t=Y6lD1uj5Q0yszbgL-4',
{
props: {
small: figma.enum('Size', {
Small: true,
}),
},
example: ({ small }) => (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below may be incomplete.
<Loading withOverlay={false} small={small} />
),
}
);

figma.connect(
InlineLoading,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=3238-28455&t=Y6lD1uj5Q0yszbgL-4',
{
variant: { Size: 'Inline' },
props: {
description: figma.textContent('Loading message'),
status: figma.enum('State', {
Active: 'active',
Error: 'error',
Finished: 'finished',
Inactive: 'inactive',
}),
},
example: ({ status, description }) => (
// Disclaimer: Code Connect is currently in beta and integration with Carbon
// React is in an exploratory phase. Code sample below may be incomplete.
<InlineLoading
iconDescription="Loading"
status={status}
description={description}
/>
),
}
);
Loading
Loading