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

feat(code-connect): Connect AILabel #17334

Merged
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
51 changes: 51 additions & 0 deletions packages/react/code-connect/AILabel/AILabel.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* 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 { AILabel } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
AILabel,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=51447-1916&t=9XaizJDx8eI6KgQz-4',
{
props: {
aiText: figma.string('Text translation'),
size: figma.enum('Size', {
'16px': 'mini',
'20px': '2xs',
'24px': 'xs',
'32px': 'sm',
'40px': 'md',
'48px': 'lg',
'64px': 'xl',
}),
},
example: ({ ...props }) => <AILabel autoAlign {...props} />,
}
);

// inline
figma.connect(
AILabel,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=51447-2035&t=9XaizJDx8eI6KgQz-4',
{
props: {
aiText: figma.string('Text translation'),
textLabel: figma.enum('Type', {
'Text + Icon': figma.string('Slug text'),
}),
size: figma.enum('Size', {
'12px': 'sm',
'14px': 'md',
'16px': 'lg',
}),
},
example: ({ ...props }) => <AILabel autoAlign kind="inline" {...props} />,
}
);
22 changes: 22 additions & 0 deletions packages/react/code-connect/AILabel/AILabelActions.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 { AILabelActions } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
AILabelActions,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=57561-3559&t=SB9qULZbn3FRopvU-4',
{
props: {
children: figma.children('*'),
},
example: ({ children }) => <AILabelActions>{children}</AILabelActions>,
}
);
64 changes: 64 additions & 0 deletions packages/react/code-connect/AILabel/AILabelContent.figma.tsx
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 { AILabelContent } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
AILabelContent,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=57561-3508&t=SB9qULZbn3FRopvU-4',
{
props: {
title: figma.string('AI title'),
description: figma.string('AI description'),
slotOne: figma.boolean('Slot 1', {
true: figma.instance('Swap slot 1'),
false: '',
}),
slotTwo: figma.boolean('Slot 2', {
true: figma.instance('Swap slot 2'),
}),
slotThree: figma.boolean('Slot 3', {
true: figma.instance('Swap slot 3'),
}),
slotFour: figma.boolean('Slot 4', {
true: figma.instance('Swap slot 4'),
}),
actions: figma.children(['Actions footer']),
},
example: ({
title,
description,
slotOne,
slotTwo,
slotThree,
slotFour,
actions,
}) => (
<AILabelContent>
{slotOne}
<div>
<p>AI Explained</p>
<h1>{title}</h1>
<p>{description}</p>
{slotOne}
<hr />
{slotTwo}
<p>
This is sample placeholder content, replace with your own content
and custom styles.
</p>
{slotThree}
{slotFour}
</div>
{actions}
</AILabelContent>
),
}
);
9 changes: 5 additions & 4 deletions packages/react/code-connect/Tabs/Tabs.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable react/jsx-no-duplicate-props */
// @ts-nocheck
import React from 'react';
import {
Expand Down Expand Up @@ -34,12 +33,14 @@ figma.connect(
size: figma.enum('Size', {
Large: 'lg',
}),
dismissable: figma.boolean('Dismissible'),
dismissablePlusIcon: figma.boolean('Dismissible + Icon'),
dismissable: figma.boolean('Dismissible', {
true: true,
false: figma.boolean('Dismissible + Icon'),
}),
}),
},
example: ({ children, contained, fullWidth, tab }) => (
<Tabs dismissable={tab.dismissable} dismissable={tab.dismissablePlusIcon}>
<Tabs dismissable={tab.dismissable}>
<TabList
aria-label="List of tabs"
contained={contained}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/code-connect/Tooltip/Tooltip.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ figma.connect(
openOnHover
definition={tooltip.definition}
align={align}>
{tooltip.children}
{item.children}
</DefinitionTooltip>
),
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@babel/preset-typescript": "^7.24.7",
"@carbon/test-utils": "^10.32.0-rc.0",
"@carbon/themes": "^11.40.0-rc.0",
"@figma/code-connect": "^1.0.4",
"@figma/code-connect": "^1.0.6",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-commonjs": "^26.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
Expand Down
Loading
Loading