From c01e8da998d73584531a1a4e84ec60e3e2ebb787 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 17 Jun 2024 12:01:14 -0400 Subject: [PATCH 01/17] feat(AILabel): rename Slug to AILabel --- .../components/Slug/Slug-examples.stories.js | 2 +- packages/react/src/components/Slug/Slug.mdx | 2 +- .../components/Slug/__tests__/Slug-test.js | 24 ++++---- packages/react/src/components/Slug/index.js | 60 +++++++++---------- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/packages/react/src/components/Slug/Slug-examples.stories.js b/packages/react/src/components/Slug/Slug-examples.stories.js index a423b5aa9f36..3057a83611fd 100644 --- a/packages/react/src/components/Slug/Slug-examples.stories.js +++ b/packages/react/src/components/Slug/Slug-examples.stories.js @@ -41,7 +41,7 @@ import { Folders, Asleep, } from '@carbon/icons-react'; -import { Slug, SlugContent, SlugActions } from '../Slug'; +import { AILabel, AILabelContent, AILabelActions } from '.'; import './slug-story.scss'; import mdx from './SlugExamples.mdx'; diff --git a/packages/react/src/components/Slug/Slug.mdx b/packages/react/src/components/Slug/Slug.mdx index 25cc8a4e64e1..eee6c67175c6 100644 --- a/packages/react/src/components/Slug/Slug.mdx +++ b/packages/react/src/components/Slug/Slug.mdx @@ -1,5 +1,5 @@ import { ArgsTable, Canvas, Story } from '@storybook/blocks'; -import { Slug, SlugContent, SlugActions } from '../Slug'; +import { Slug, SlugContent, SlugActions } from '.'; import * as SlugStories from './Slug.stories'; # Slug diff --git a/packages/react/src/components/Slug/__tests__/Slug-test.js b/packages/react/src/components/Slug/__tests__/Slug-test.js index 7b8fd1d7d137..2987d94a0bd8 100644 --- a/packages/react/src/components/Slug/__tests__/Slug-test.js +++ b/packages/react/src/components/Slug/__tests__/Slug-test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { Slug } from '../../Slug'; +import { AILabel } from '../'; import { render, screen } from '@testing-library/react'; const prefix = 'cds'; @@ -14,7 +14,7 @@ const prefix = 'cds'; describe('Slug', () => { describe('renders as expected - Component API', () => { it('should spread extra props onto the popover element', () => { - const { container } = render(); + const { container } = render(); expect(container.firstChild.firstChild).toHaveAttribute( 'data-testid', @@ -23,32 +23,32 @@ describe('Slug', () => { }); it('should render children as expected', () => { - render(Children test); + render(Children test); expect(screen.getByText('Children test')).toBeInTheDocument(); }); it('should support a custom `className` prop on the outermost element', () => { - const { container } = render(); + const { container } = render(); expect(container.firstChild).toHaveClass('custom-class'); }); it('should respect aiText prop', () => { - render(); + render(); expect(screen.getByText('IA')).toBeInTheDocument(); }); it('should respect aiTextLabel prop', () => { - render(); + render(); expect(screen.getByText('Test text')).toBeInTheDocument(); }); it('should respect align prop when autoAlign is false', () => { render( - + ); expect(screen.getByTestId('test')).not.toHaveClass( @@ -60,7 +60,7 @@ describe('Slug', () => { }); it('should apply align prop classes even when autoAlign is true', () => { - render(); + render(); expect(screen.getByTestId('test')).toHaveClass( `${prefix}--popover--auto-align` @@ -71,7 +71,7 @@ describe('Slug', () => { }); it('should respect kind prop', () => { - render(); + render(); expect(screen.getByRole('button')).toHaveClass( `${prefix}--slug__button--inline` @@ -79,7 +79,7 @@ describe('Slug', () => { }); it('should respect revertActive prop', () => { - const { container } = render(); + const { container } = render(); expect(container.firstChild).toHaveClass(`${prefix}--slug--revert`); expect(container.firstChild.firstChild).toHaveClass( @@ -88,13 +88,13 @@ describe('Slug', () => { }); it('should respect revertLabel prop', () => { - render(); + render(); expect(screen.getByText('Test revert label')).toBeInTheDocument(); }); it('should respect size prop', () => { - render(); + render(); expect(screen.getByRole('button')).toHaveClass( `${prefix}--slug__button--xl` diff --git a/packages/react/src/components/Slug/index.js b/packages/react/src/components/Slug/index.js index 8a87f418bc46..13261f1b0c70 100644 --- a/packages/react/src/components/Slug/index.js +++ b/packages/react/src/components/Slug/index.js @@ -20,30 +20,30 @@ import { IconButton } from '../IconButton'; import { Undo } from '@carbon/icons-react'; import { useId } from '../../internal/useId'; -export const SlugContent = React.forwardRef(function SlugContent( +export const AILabelContent = React.forwardRef(function AILabelContent( { children, className }, ref ) { const prefix = usePrefix(); - const hasSlugActions = React.Children.toArray(children).some( - (child) => child.type?.displayName === 'SlugActions' + const hasAILabelActions = React.Children.toArray(children).some( + (child) => child.type?.displayName === 'AILabelActions' ); - const slugContentClasses = cx(className, { + const aiLabelContentClasses = cx(className, { [`${prefix}--slug-content`]: true, - [`${prefix}--slug-content--with-actions`]: hasSlugActions, + [`${prefix}--slug-content--with-actions`]: hasAILabelActions, }); return ( - + {children} ); }); -SlugContent.displayName = 'SlugContent'; -SlugContent.propTypes = { +AILabelContent.displayName = 'AILabelContent'; +AILabelContent.propTypes = { /** * Specify the content you want rendered inside the slug ToggleTip */ @@ -55,25 +55,25 @@ SlugContent.propTypes = { className: PropTypes.string, }; -export const SlugActions = React.forwardRef(function SlugActions( +export const AILabelActions = React.forwardRef(function AILabelActions( { children, className }, ref ) { const prefix = usePrefix(); - const slugActionBarClasses = cx(className, { + const aiLabelActionsClasses = cx(className, { [`${prefix}--slug-actions`]: true, }); return ( - + {children} ); }); -SlugActions.displayName = 'SlugActions'; -SlugActions.propTypes = { +AILabelActions.displayName = 'AILabelActions'; +AILabelActions.propTypes = { /** * Specify the content you want rendered inside the slug callout toolbar */ @@ -85,7 +85,7 @@ SlugActions.propTypes = { className: PropTypes.string, }; -export const Slug = React.forwardRef(function Slug( +export const AILabel = React.forwardRef(function AILabel( { aiText = 'AI', aiTextLabel, @@ -104,14 +104,14 @@ export const Slug = React.forwardRef(function Slug( ref ) { const prefix = usePrefix(); - const id = useId('slug'); + const id = useId('AILabel'); - const slugClasses = cx(className, { + const aiLabelClasses = cx(className, { [`${prefix}--slug`]: true, [`${prefix}--slug--revert`]: revertActive, }); - const slugButtonClasses = cx({ + const aiLabelButtonClasses = cx({ [`${prefix}--slug__button`]: true, [`${prefix}--slug__button--${size}`]: size, [`${prefix}--slug__button--${kind}`]: kind, @@ -130,7 +130,7 @@ export const Slug = React.forwardRef(function Slug( : `${aiText} - ${aiTextLabel}`; return ( -
+
{revertActive ? ( ) : ( - + {aiText} {aiTextLabel && ( @@ -157,8 +157,13 @@ export const Slug = React.forwardRef(function Slug( ); }); -Slug.displayName = 'Slug'; -Slug.propTypes = { +AILabel.displayName = 'AILabel'; +AILabel.propTypes = { + /** + * Specify the content you want rendered inside the `AILabel` ToggleTip + */ + AILabelContent: PropTypes.node, + /** * Specify the correct translation of the AI text */ @@ -204,17 +209,17 @@ Slug.propTypes = { autoAlign: PropTypes.bool, /** - * Specify the content you want rendered inside the slug ToggleTip + * Specify the content you want rendered inside the `AILabel` ToggleTip */ children: PropTypes.node, /** - * Specify an optional className to be added to the AI slug + * Specify an optional className to be added to the `AILabel` */ className: PropTypes.string, /** - * Specify the type of Slug, from the following list of types: + * Specify the type of `AILabel`, from the following list of types: */ kind: PropTypes.oneOf(['default', 'inline']), @@ -239,12 +244,7 @@ Slug.propTypes = { size: PropTypes.oneOf(['mini', '2xs', 'xs', 'sm', 'md', 'lg', 'xl']), /** - * Specify the content you want rendered inside the slug ToggleTip - */ - slugContent: PropTypes.node, - - /** - * Specify the text that will be provided to the aria-label of the `Slug` button + * Specify the text that will be provided to the aria-label of the `AILabel` button */ slugLabel: PropTypes.string, }; From 3cfd32eebaff68fc774568d24f07b2d70de6da72 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 17 Jun 2024 12:20:24 -0400 Subject: [PATCH 02/17] docs(AILabel): update mdx file to use new name --- .../{Slug.stories.js => AILabel.stories.js} | 172 +++++++++--------- packages/react/src/components/Slug/Slug.mdx | 136 +++++++------- 2 files changed, 154 insertions(+), 154 deletions(-) rename packages/react/src/components/Slug/{Slug.stories.js => AILabel.stories.js} (78%) diff --git a/packages/react/src/components/Slug/Slug.stories.js b/packages/react/src/components/Slug/AILabel.stories.js similarity index 78% rename from packages/react/src/components/Slug/Slug.stories.js rename to packages/react/src/components/Slug/AILabel.stories.js index c8d80183a84d..4c4f3f4338fd 100644 --- a/packages/react/src/components/Slug/Slug.stories.js +++ b/packages/react/src/components/Slug/AILabel.stories.js @@ -9,7 +9,7 @@ import React from 'react'; -import { Slug, SlugContent, SlugActions } from '.'; +import { AILabel, AILabelContent, AILabelActions } from '.'; import { View, FolderOpen, Folders } from '@carbon/icons-react'; import Button from '../Button'; import { IconButton } from '../IconButton'; @@ -17,8 +17,8 @@ import mdx from './Slug.mdx'; import './slug-story.scss'; export default { - title: 'Experimental/unstable__Slug', - component: Slug, + title: 'Components/AILabel', + component: AILabel, parameters: { docs: { page: mdx, @@ -44,16 +44,16 @@ const aiContent = ( export const Default = () => ( <>
- - {aiContent} - - - {aiContent} - - - + + {aiContent} + + + {aiContent} + + + {aiContent} - + @@ -64,13 +64,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -81,13 +81,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -98,13 +98,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -115,13 +115,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -132,15 +132,15 @@ export const Default = () => ( - - - + + +
- - + + {aiContent} - + @@ -151,13 +151,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -168,13 +168,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -185,15 +185,15 @@ export const Default = () => ( - - - + + +
- - + + {aiContent} - + @@ -204,13 +204,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -221,13 +221,13 @@ export const Default = () => ( - - - - - + + + + + {aiContent} - + @@ -238,9 +238,9 @@ export const Default = () => ( - - - + + +
); @@ -250,8 +250,8 @@ export const Callout = (args) => { return (
- - + + {' '}

AI Explained

@@ -267,7 +267,7 @@ export const Callout = (args) => {

Foundation model

{showSlugActions && ( - + @@ -278,10 +278,10 @@ export const Callout = (args) => { - + )} -
-
+ +
); }; @@ -393,7 +393,7 @@ export const Playground = (args) => {

Foundation model

{showSlugActions && ( - + @@ -404,7 +404,7 @@ export const Playground = (args) => { - + )} ); @@ -412,9 +412,9 @@ export const Playground = (args) => { return ( <>
- - {renderedContent} - + + {renderedContent} +
diff --git a/packages/react/src/components/Slug/Slug.mdx b/packages/react/src/components/Slug/Slug.mdx index eee6c67175c6..64b2bd87c5c5 100644 --- a/packages/react/src/components/Slug/Slug.mdx +++ b/packages/react/src/components/Slug/Slug.mdx @@ -1,61 +1,61 @@ import { ArgsTable, Canvas, Story } from '@storybook/blocks'; -import { Slug, SlugContent, SlugActions } from '.'; -import * as SlugStories from './Slug.stories'; +import { AILabel, AILabelContent, AILabelActions } from '.'; +import * as AILabelStories from './AILabel.stories'; -# Slug +# AILabel [Source code](https://github.com/carbon-design-system/carbon/tree/main/packages/react/src/components/Slug) | -[Slug release status](https://airtable.com/appCAqlGVN8tRUbAp/shr71ZyLlIGORz3Vh/tblHqPusgkK8hIeHo) +[AILabel release status](https://airtable.com/appCAqlGVN8tRUbAp/shr71ZyLlIGORz3Vh/tblHqPusgkK8hIeHo) | [Using AI-enhanced components in V10](https://github.com/carbon-design-system/carbon-for-ai/blob/main/docs/support-for-carbon-v10.md) ## Table of Contents - [Overview](#overview) -- [Slug anatomy](#slug-anatomy) +- [AILabel anatomy](#ailabel-anatomy) - [Component API](#component-api) - - [Slug `aiText`](#slug-aitext) - - [Slug `aiTextLabel`](#slug-aitextlabel) - - [Slug `kind`](#slug-kind) - - [Slug `revertActive` and `onRevertClick`](#slug-revertactive-and-onrevertclick) + - [AILabel `aiText`](#ailabel-aitext) + - [AILabel `aiTextLabel`](#ailabel-aitextlabel) + - [AILabel `kind`](#ailabel-kind) + - [AILabel `revertActive` and `onRevertClick`](#ailabel-revertactive-and-onrevertclick) - [Feedback](#feedback) ## Overview -The AI slug is intended for any scenario where something is being generated by +The AI Label is intended for any scenario where something is being generated by (or with) AI to reinforce AI transparency, accountability, and explainability at any interface level. This also enables more effective recognition and recall of AI instances in a way that is identifiable across any IBM product. - + -## Slug anatomy +## AILabel anatomy -The `Slug` itself is a button that acts as a `Toggletip` trigger. To construct -the contents of the `Slug` callout, you can place the desired elements as a -child of `Slug` in `SlugContent`, like so: +The `AILabel` itself is a button that acts as a `Toggletip` trigger. To +construct the contents of the `AILabel` callout, you can place the desired +elements as a child of `AILabel` in `AILabelContent`, like so: ```jsx - - + + {Content Here} - - + + ``` -The `Slug` also supports the rendering of an action bar at the bottom of the -callout. To achieve this, you can pass in `SlugActions` as a child of `Slug`, -placed inside the `SlugContent` +The `AILabel` also supports the rendering of an action bar at the bottom of the +callout. To achieve this, you can pass in `AILabelActions` as a child of +`AILabel`, placed inside the `AILabelContent` ```jsx - - + + {Content Here} - {Optional Slug action bar} - + {Optional AILabel action bar} + @@ -66,84 +66,84 @@ placed inside the `SlugContent` - - - + + + ``` ## Component API -### Slug `aiText` +### AILabel `aiText` -If needed, you can change the text inside the `Slug` when translating to +If needed, you can change the text inside the `AILabel` when translating to different languages. - - Explanation of AI generated content - + + Explanation of AI generated content + ```jsx - - Explanation of AI-generated content - + + Explanation of AI-generated content + ``` -### Slug `aiTextLabel` +### AILabel `aiTextLabel` When using the `inline` variant, you can add text adjacent to the AI label with the `aiTextLabel` prop. - - Explanation of AI generated content - + + Explanation of AI generated content +
- - Explanation of AI generated content - + + Explanation of AI generated content + ```jsx - - Explanation of AI generated content - + + Explanation of AI generated content + - - Explanation of AI generated content - + + Explanation of AI generated content + ``` -### Slug `kind` +### AILabel `kind` -The `Slug` component has two variants, `default` and `inline`. +The `AILabel` component has two variants, `default` and `inline`. - - AI was used to generate this content - + + AI was used to generate this content + ```jsx - - AI was used to generate this content - + + AI was used to generate this content + ``` -The `inline` `Slug` with the standard icon can also trigger the AI +The `inline` `AILabel` with the standard icon can also trigger the AI explainability callout. - - Explanation of AI generated content - + + Explanation of AI generated content + ```jsx - - Explanation of AI-generated content - + + Explanation of AI-generated content + ``` -### Slug `revertActive` and `onRevertClick` +### AILabel `revertActive` and `onRevertClick` -`revertActive` is a boolean prop that can be set on `Slug` that transforms the -`Slug` into a revert action button. This is useful if a user edits an +`revertActive` is a boolean prop that can be set on `AILabel` that transforms +the `AILabel` into a revert action button. This is useful if a user edits an AI-generated input to show that the element has been modified. This can be used in conjunction with the `onRevertClick` callback to handle restoring the element to the AI-generated state. For an example, please take a look at the From b940a8b9a9829ef409803ae9cc0a267ee596ad4b Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 17 Jun 2024 12:21:23 -0400 Subject: [PATCH 03/17] chore(AILabel): rename Slug folder to AILabel --- .../react/src/components/{Slug => AILabel}/AILabel.stories.js | 0 .../src/components/{Slug => AILabel}/Slug-examples.stories.js | 0 .../react/src/components/{Slug => AILabel}/Slug-form.stories.js | 0 packages/react/src/components/{Slug => AILabel}/Slug.mdx | 0 packages/react/src/components/{Slug => AILabel}/SlugDatatable.mdx | 0 packages/react/src/components/{Slug => AILabel}/SlugExamples.mdx | 0 packages/react/src/components/{Slug => AILabel}/SlugForm.mdx | 0 .../react/src/components/{Slug => AILabel}/__tests__/Slug-test.js | 0 packages/react/src/components/{Slug => AILabel}/index.js | 0 packages/react/src/components/{Slug => AILabel}/slug-story.scss | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename packages/react/src/components/{Slug => AILabel}/AILabel.stories.js (100%) rename packages/react/src/components/{Slug => AILabel}/Slug-examples.stories.js (100%) rename packages/react/src/components/{Slug => AILabel}/Slug-form.stories.js (100%) rename packages/react/src/components/{Slug => AILabel}/Slug.mdx (100%) rename packages/react/src/components/{Slug => AILabel}/SlugDatatable.mdx (100%) rename packages/react/src/components/{Slug => AILabel}/SlugExamples.mdx (100%) rename packages/react/src/components/{Slug => AILabel}/SlugForm.mdx (100%) rename packages/react/src/components/{Slug => AILabel}/__tests__/Slug-test.js (100%) rename packages/react/src/components/{Slug => AILabel}/index.js (100%) rename packages/react/src/components/{Slug => AILabel}/slug-story.scss (100%) diff --git a/packages/react/src/components/Slug/AILabel.stories.js b/packages/react/src/components/AILabel/AILabel.stories.js similarity index 100% rename from packages/react/src/components/Slug/AILabel.stories.js rename to packages/react/src/components/AILabel/AILabel.stories.js diff --git a/packages/react/src/components/Slug/Slug-examples.stories.js b/packages/react/src/components/AILabel/Slug-examples.stories.js similarity index 100% rename from packages/react/src/components/Slug/Slug-examples.stories.js rename to packages/react/src/components/AILabel/Slug-examples.stories.js diff --git a/packages/react/src/components/Slug/Slug-form.stories.js b/packages/react/src/components/AILabel/Slug-form.stories.js similarity index 100% rename from packages/react/src/components/Slug/Slug-form.stories.js rename to packages/react/src/components/AILabel/Slug-form.stories.js diff --git a/packages/react/src/components/Slug/Slug.mdx b/packages/react/src/components/AILabel/Slug.mdx similarity index 100% rename from packages/react/src/components/Slug/Slug.mdx rename to packages/react/src/components/AILabel/Slug.mdx diff --git a/packages/react/src/components/Slug/SlugDatatable.mdx b/packages/react/src/components/AILabel/SlugDatatable.mdx similarity index 100% rename from packages/react/src/components/Slug/SlugDatatable.mdx rename to packages/react/src/components/AILabel/SlugDatatable.mdx diff --git a/packages/react/src/components/Slug/SlugExamples.mdx b/packages/react/src/components/AILabel/SlugExamples.mdx similarity index 100% rename from packages/react/src/components/Slug/SlugExamples.mdx rename to packages/react/src/components/AILabel/SlugExamples.mdx diff --git a/packages/react/src/components/Slug/SlugForm.mdx b/packages/react/src/components/AILabel/SlugForm.mdx similarity index 100% rename from packages/react/src/components/Slug/SlugForm.mdx rename to packages/react/src/components/AILabel/SlugForm.mdx diff --git a/packages/react/src/components/Slug/__tests__/Slug-test.js b/packages/react/src/components/AILabel/__tests__/Slug-test.js similarity index 100% rename from packages/react/src/components/Slug/__tests__/Slug-test.js rename to packages/react/src/components/AILabel/__tests__/Slug-test.js diff --git a/packages/react/src/components/Slug/index.js b/packages/react/src/components/AILabel/index.js similarity index 100% rename from packages/react/src/components/Slug/index.js rename to packages/react/src/components/AILabel/index.js diff --git a/packages/react/src/components/Slug/slug-story.scss b/packages/react/src/components/AILabel/slug-story.scss similarity index 100% rename from packages/react/src/components/Slug/slug-story.scss rename to packages/react/src/components/AILabel/slug-story.scss From 88bd87828e37e72d50f726b8f778b53cec3de363 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 17 Jun 2024 13:23:06 -0400 Subject: [PATCH 04/17] chore(AILabel): more renaming, diplsyName updates, checkbox story --- .../AILabel/{Slug.mdx => AILabel.mdx} | 0 .../src/components/AILabel/AILabel.stories.js | 4 +- .../AILabel/Slug-examples.stories.js | 28 +++---- .../components/AILabel/Slug-form.stories.js | 2 +- .../{slug-story.scss => ailabel-story.scss} | 0 .../components/Checkbox/Checkbox.stories.js | 73 +++++++++++++++++++ .../CheckboxGroup/CheckboxGroup.tsx | 2 +- .../src/components/ComboBox/ComboBox.tsx | 2 +- .../ComposedModal/ComposedModal.tsx | 2 +- .../stories/DataTable-slug.stories.js | 45 ++++++------ .../DatePickerInput/DatePickerInput.tsx | 2 +- .../src/components/Dropdown/Dropdown.tsx | 2 +- packages/react/src/components/Modal/Modal.tsx | 2 +- .../MultiSelect/FilterableMultiSelect.tsx | 2 +- .../components/MultiSelect/MultiSelect.tsx | 2 +- .../components/NumberInput/NumberInput.tsx | 4 +- .../RadioButtonGroup/RadioButtonGroup.tsx | 2 +- .../src/components/RadioTile/RadioTile.tsx | 2 +- .../react/src/components/Select/Select.tsx | 2 +- .../src/components/Tag/DismissibleTag.tsx | 2 +- .../src/components/Tag/OperationalTag.tsx | 2 +- .../src/components/Tag/SelectableTag.tsx | 2 +- packages/react/src/components/Tag/Tag.tsx | 2 +- .../src/components/TextArea/TextArea.tsx | 2 +- .../src/components/TextInput/TextInput.tsx | 2 +- packages/react/src/components/Tile/Tile.tsx | 4 +- packages/react/src/index.js | 11 ++- packages/react/src/index.ts | 10 ++- 28 files changed, 148 insertions(+), 67 deletions(-) rename packages/react/src/components/AILabel/{Slug.mdx => AILabel.mdx} (100%) rename packages/react/src/components/AILabel/{slug-story.scss => ailabel-story.scss} (100%) diff --git a/packages/react/src/components/AILabel/Slug.mdx b/packages/react/src/components/AILabel/AILabel.mdx similarity index 100% rename from packages/react/src/components/AILabel/Slug.mdx rename to packages/react/src/components/AILabel/AILabel.mdx diff --git a/packages/react/src/components/AILabel/AILabel.stories.js b/packages/react/src/components/AILabel/AILabel.stories.js index 4c4f3f4338fd..d175547d9202 100644 --- a/packages/react/src/components/AILabel/AILabel.stories.js +++ b/packages/react/src/components/AILabel/AILabel.stories.js @@ -13,8 +13,8 @@ import { AILabel, AILabelContent, AILabelActions } from '.'; import { View, FolderOpen, Folders } from '@carbon/icons-react'; import Button from '../Button'; import { IconButton } from '../IconButton'; -import mdx from './Slug.mdx'; -import './slug-story.scss'; +import mdx from './AILabel.mdx'; +import './ailabel-story.scss'; export default { title: 'Components/AILabel', diff --git a/packages/react/src/components/AILabel/Slug-examples.stories.js b/packages/react/src/components/AILabel/Slug-examples.stories.js index 3057a83611fd..ccf53fb47a2f 100644 --- a/packages/react/src/components/AILabel/Slug-examples.stories.js +++ b/packages/react/src/components/AILabel/Slug-examples.stories.js @@ -42,7 +42,7 @@ import { Asleep, } from '@carbon/icons-react'; import { AILabel, AILabelContent, AILabelActions } from '.'; -import './slug-story.scss'; +import './ailabel-story.scss'; import mdx from './SlugExamples.mdx'; export default { @@ -161,9 +161,9 @@ const items = [ }, ]; -const slug = ( - - +const aiLabel = ( + +

AI Explained

84%

@@ -176,7 +176,7 @@ const slug = (

Model type

Foundation model

- + @@ -187,14 +187,14 @@ const slug = ( - -
-
+ + + ); const slugFunc = (kind) => ( - - + +

AI Explained

84%

@@ -207,7 +207,7 @@ const slugFunc = (kind) => (

Model type

Foundation model

- + @@ -218,9 +218,9 @@ const slugFunc = (kind) => ( - -
-
+ + + ); export const _Checkbox = { diff --git a/packages/react/src/components/AILabel/Slug-form.stories.js b/packages/react/src/components/AILabel/Slug-form.stories.js index ba392c09f083..69092881a4ca 100644 --- a/packages/react/src/components/AILabel/Slug-form.stories.js +++ b/packages/react/src/components/AILabel/Slug-form.stories.js @@ -25,7 +25,7 @@ import { Stack } from '../Stack'; import { IconButton } from '../IconButton'; import { View, FolderOpen, Folders } from '@carbon/icons-react'; import { Slug, SlugContent, SlugActions } from '.'; -import './slug-story.scss'; +import './ailabel-story.scss'; import mdx from './SlugForm.mdx'; export default { diff --git a/packages/react/src/components/AILabel/slug-story.scss b/packages/react/src/components/AILabel/ailabel-story.scss similarity index 100% rename from packages/react/src/components/AILabel/slug-story.scss rename to packages/react/src/components/AILabel/ailabel-story.scss diff --git a/packages/react/src/components/Checkbox/Checkbox.stories.js b/packages/react/src/components/Checkbox/Checkbox.stories.js index c556daff677b..66dd548618f0 100644 --- a/packages/react/src/components/Checkbox/Checkbox.stories.js +++ b/packages/react/src/components/Checkbox/Checkbox.stories.js @@ -9,6 +9,10 @@ import React from 'react'; import { default as Checkbox, CheckboxSkeleton } from './'; import mdx from './Checkbox.mdx'; import CheckboxGroup from '../CheckboxGroup'; +import Button from '../Button'; +import { AILabel, AILabelContent, AILabelActions } from '../AILabel'; +import { IconButton } from '../IconButton'; +import { View, FolderOpen, Folders } from '@carbon/icons-react'; const checkboxEvents = { className: 'some-class', @@ -86,6 +90,75 @@ export const Single = () => { export const Skeleton = () => ; +const slugFunc = (kind) => ( + + +
+

AI Explained

+

84%

+

Confidence score

+

+ Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut fsil labore et dolore magna aliqua. +

+
+

Model type

+

Foundation model

+
+ + + + + + + + + + + + +
+
+); + +export const withAILabel = () => ( +
+ + + + + + + + + + + + + + + + + +
+); + export const Playground = (args) => ( = ({ let normalizedSlug; if ( React.isValidElement(slug) && - (slug['type'] as any)?.displayName === 'Slug' + (slug['type'] as any)?.displayName === 'AILabel' ) { normalizedSlug = React.cloneElement(slug, { size: 'mini', diff --git a/packages/react/src/components/ComboBox/ComboBox.tsx b/packages/react/src/components/ComboBox/ComboBox.tsx index 3563cf7a207e..74c93120292a 100644 --- a/packages/react/src/components/ComboBox/ComboBox.tsx +++ b/packages/react/src/components/ComboBox/ComboBox.tsx @@ -559,7 +559,7 @@ const ComboBox = forwardRef( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/ComposedModal/ComposedModal.tsx b/packages/react/src/components/ComposedModal/ComposedModal.tsx index c7b3558efd0a..db268c68d59b 100644 --- a/packages/react/src/components/ComposedModal/ComposedModal.tsx +++ b/packages/react/src/components/ComposedModal/ComposedModal.tsx @@ -408,7 +408,7 @@ const ComposedModal = React.forwardRef( // Slug is always size `sm` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'sm', }); diff --git a/packages/react/src/components/DataTable/stories/DataTable-slug.stories.js b/packages/react/src/components/DataTable/stories/DataTable-slug.stories.js index daed3c32ba2c..57840b024872 100644 --- a/packages/react/src/components/DataTable/stories/DataTable-slug.stories.js +++ b/packages/react/src/components/DataTable/stories/DataTable-slug.stories.js @@ -22,11 +22,11 @@ import DataTable, { TableExpandedRow, } from '..'; import { rows, headers } from './shared'; -import mdx from '../../Slug/SlugDatatable.mdx'; +import mdx from '../../AILabel/SlugDatatable.mdx'; import Button from '../../Button'; import { IconButton } from '../../IconButton'; import { View, FolderOpen, Folders } from '@carbon/icons-react'; -import { Slug, SlugContent, SlugActions } from '../../Slug'; +import { AILabel, AILabelContent, AILabelActions } from '../../AILabel'; import './datatable-story.scss'; export default { @@ -72,8 +72,11 @@ const columnSlugHeaders = [ key: 'attached_groups', header: 'Attached groups', slug: ( - - + +

AI Explained

84%

@@ -87,7 +90,7 @@ const columnSlugHeaders = [

Model type

Foundation model

- + @@ -98,9 +101,9 @@ const columnSlugHeaders = [ - -
-
+ + + ), }, { @@ -109,9 +112,9 @@ const columnSlugHeaders = [ }, ]; -const slug = ( - - +const aiLabel = ( + +

AI Explained

84%

@@ -124,7 +127,7 @@ const slug = (

Model type

Foundation model

- + @@ -135,12 +138,12 @@ const slug = ( - -
-
+ + + ); -export const SlugWithSelection = () => ( +export const AILabelWithSelection = () => ( {({ rows, @@ -171,7 +174,7 @@ export const SlugWithSelection = () => ( {rows.map((row, i) => ( {row.cells.map((cell) => ( @@ -186,7 +189,7 @@ export const SlugWithSelection = () => ( ); -export const SlugWithRadioSelection = () => ( +export const AILabelWithRadioSelection = () => ( {({ rows, @@ -217,7 +220,7 @@ export const SlugWithRadioSelection = () => ( {rows.map((row, i) => ( {row.cells.map((cell) => ( @@ -270,7 +273,7 @@ export const SlugWithSelectionAndExpansion = () => ( {row.cells.map((cell) => ( @@ -329,7 +332,7 @@ export const SlugWithExpansion = () => ( {row.cells.map((cell) => ( {cell.value} diff --git a/packages/react/src/components/DatePickerInput/DatePickerInput.tsx b/packages/react/src/components/DatePickerInput/DatePickerInput.tsx index 4575042fcb6b..2973fd18be4a 100644 --- a/packages/react/src/components/DatePickerInput/DatePickerInput.tsx +++ b/packages/react/src/components/DatePickerInput/DatePickerInput.tsx @@ -218,7 +218,7 @@ const DatePickerInput = React.forwardRef(function DatePickerInput( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/Dropdown/Dropdown.tsx b/packages/react/src/components/Dropdown/Dropdown.tsx index 35d90000a9fb..86fd8e34d85a 100644 --- a/packages/react/src/components/Dropdown/Dropdown.tsx +++ b/packages/react/src/components/Dropdown/Dropdown.tsx @@ -450,7 +450,7 @@ const Dropdown = React.forwardRef( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/Modal/Modal.tsx b/packages/react/src/components/Modal/Modal.tsx index c5631a97182c..be4cff7e9300 100644 --- a/packages/react/src/components/Modal/Modal.tsx +++ b/packages/react/src/components/Modal/Modal.tsx @@ -475,7 +475,7 @@ const Modal = React.forwardRef(function Modal( // Slug is always size `sm` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'sm', }); diff --git a/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx b/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx index 785471470d62..9c40a7837086 100644 --- a/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx +++ b/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx @@ -562,7 +562,7 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect< // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/MultiSelect/MultiSelect.tsx b/packages/react/src/components/MultiSelect/MultiSelect.tsx index c8d711cf0371..7c32c4760ffb 100644 --- a/packages/react/src/components/MultiSelect/MultiSelect.tsx +++ b/packages/react/src/components/MultiSelect/MultiSelect.tsx @@ -643,7 +643,7 @@ const MultiSelect = React.forwardRef( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/NumberInput/NumberInput.tsx b/packages/react/src/components/NumberInput/NumberInput.tsx index 89e789ab97a8..37b0109adab3 100644 --- a/packages/react/src/components/NumberInput/NumberInput.tsx +++ b/packages/react/src/components/NumberInput/NumberInput.tsx @@ -371,7 +371,7 @@ const NumberInput = React.forwardRef( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); @@ -379,7 +379,7 @@ const NumberInput = React.forwardRef( // Need to update the internal value when the revert button is clicked let isRevertActive; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { isRevertActive = normalizedSlug.props.revertActive; } diff --git a/packages/react/src/components/RadioButtonGroup/RadioButtonGroup.tsx b/packages/react/src/components/RadioButtonGroup/RadioButtonGroup.tsx index 12028b795c5c..e65e6c6a0e28 100644 --- a/packages/react/src/components/RadioButtonGroup/RadioButtonGroup.tsx +++ b/packages/react/src/components/RadioButtonGroup/RadioButtonGroup.tsx @@ -242,7 +242,7 @@ const RadioButtonGroup = React.forwardRef( // Slug is always size `mini` let normalizedSlug: ReactElement | undefined; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', kind: 'default', diff --git a/packages/react/src/components/RadioTile/RadioTile.tsx b/packages/react/src/components/RadioTile/RadioTile.tsx index f270d5759b95..f3a307146ad7 100644 --- a/packages/react/src/components/RadioTile/RadioTile.tsx +++ b/packages/react/src/components/RadioTile/RadioTile.tsx @@ -163,7 +163,7 @@ const RadioTile = React.forwardRef(function RadioTile( // Slug is always size `xs` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'xs', }); diff --git a/packages/react/src/components/Select/Select.tsx b/packages/react/src/components/Select/Select.tsx index fd9991aadd9e..560201844c7d 100644 --- a/packages/react/src/components/Select/Select.tsx +++ b/packages/react/src/components/Select/Select.tsx @@ -250,7 +250,7 @@ const Select = React.forwardRef(function Select( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/Tag/DismissibleTag.tsx b/packages/react/src/components/Tag/DismissibleTag.tsx index 541602ea35ce..ca0e6319c25d 100644 --- a/packages/react/src/components/Tag/DismissibleTag.tsx +++ b/packages/react/src/components/Tag/DismissibleTag.tsx @@ -111,7 +111,7 @@ const DismissibleTag = ({ }; let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'sm', kind: 'inline', diff --git a/packages/react/src/components/Tag/OperationalTag.tsx b/packages/react/src/components/Tag/OperationalTag.tsx index b0f6eaa9fb26..0ea39727c140 100644 --- a/packages/react/src/components/Tag/OperationalTag.tsx +++ b/packages/react/src/components/Tag/OperationalTag.tsx @@ -113,7 +113,7 @@ const OperationalTag = ({ }, [prefix, tagRef]); let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'sm', kind: 'inline', diff --git a/packages/react/src/components/Tag/SelectableTag.tsx b/packages/react/src/components/Tag/SelectableTag.tsx index d4d87e3c5344..d64b78bd0f70 100644 --- a/packages/react/src/components/Tag/SelectableTag.tsx +++ b/packages/react/src/components/Tag/SelectableTag.tsx @@ -95,7 +95,7 @@ const SelectableTag = ({ }, [prefix, tagRef]); let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'sm', kind: 'inline', diff --git a/packages/react/src/components/Tag/Tag.tsx b/packages/react/src/components/Tag/Tag.tsx index 6c7e212aa24d..e702643cfca4 100644 --- a/packages/react/src/components/Tag/Tag.tsx +++ b/packages/react/src/components/Tag/Tag.tsx @@ -171,7 +171,7 @@ const Tag = React.forwardRef(function Tag( // Slug is always size `md` and `inline` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug' && !isInteractiveTag) { + if (slug && slug['type']?.displayName === 'AILabel' && !isInteractiveTag) { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'sm', kind: 'inline', diff --git a/packages/react/src/components/TextArea/TextArea.tsx b/packages/react/src/components/TextArea/TextArea.tsx index 81236abd643b..ae9b4b5d8de2 100644 --- a/packages/react/src/components/TextArea/TextArea.tsx +++ b/packages/react/src/components/TextArea/TextArea.tsx @@ -436,7 +436,7 @@ const TextArea = React.forwardRef((props: TextAreaProps, forwardRef) => { // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/TextInput/TextInput.tsx b/packages/react/src/components/TextInput/TextInput.tsx index a6ccf9a1090f..f27e588f36ec 100644 --- a/packages/react/src/components/TextInput/TextInput.tsx +++ b/packages/react/src/components/TextInput/TextInput.tsx @@ -315,7 +315,7 @@ const TextInput = React.forwardRef(function TextInput( // Slug is always size `mini` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'mini', }); diff --git a/packages/react/src/components/Tile/Tile.tsx b/packages/react/src/components/Tile/Tile.tsx index 0dbeede5523f..03d38d427bbc 100644 --- a/packages/react/src/components/Tile/Tile.tsx +++ b/packages/react/src/components/Tile/Tile.tsx @@ -494,7 +494,7 @@ export const SelectableTile = React.forwardRef< // Slug is always size `xs` const slugRef = useRef(null); let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'xs', ref: slugRef, @@ -852,7 +852,7 @@ export const ExpandableTile = React.forwardRef< // Slug is always size `xs` let normalizedSlug; - if (slug && slug['type']?.displayName === 'Slug') { + if (slug && slug['type']?.displayName === 'AILabel') { normalizedSlug = React.cloneElement(slug as React.ReactElement, { size: 'xs', }); diff --git a/packages/react/src/index.js b/packages/react/src/index.js index 2cc0cdca1b99..0208c5ea964e 100644 --- a/packages/react/src/index.js +++ b/packages/react/src/index.js @@ -308,11 +308,14 @@ export { } from './components/Theme'; export { usePrefix } from './internal/usePrefix'; export { useIdPrefix } from './internal/useIdPrefix'; + +export { AILabel, AILabelContent, AILabelActions } from './components/AILabel'; +// Keep until V12 export { - Slug as unstable__Slug, - SlugContent as unstable__SlugContent, - SlugActions as unstable__SlugActions, -} from './components/Slug'; + AILabel as unstable__Slug, + AILabelContent as unstable__SlugContent, + AILabelActions as unstable__SlugActions, +} from './components/AILabel'; export { AiSkeletonText as unstable__AiSkeletonText, diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index d2896ffe0c79..3a2cf7d30e22 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -153,11 +153,13 @@ export { } from './components/Pagination/experimental'; export * from './components/Popover'; export * from './components/ProgressBar'; +export { AILabel, AILabelContent, AILabelActions } from './components/AILabel'; +// Keep until V12 export { - Slug as unstable__Slug, - SlugContent as unstable__SlugContent, - SlugActions as unstable__SlugActions, -} from './components/Slug'; + AILabel as unstable__Slug, + AILabelContent as unstable__SlugContent, + AILabelActions as unstable__SlugActions, +} from './components/AILabel'; export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, From 1e01a065443af4595674cadb914fa1b01d9e7b99 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 17 Jun 2024 14:38:50 -0400 Subject: [PATCH 05/17] chore(AILabel): move example stories to corresponding folders --- .../AILabel/Slug-examples.stories.js | 888 ------------------ .../components/Checkbox/Checkbox.stories.js | 3 +- .../components/ComboBox/ComboBox.stories.js | 49 + .../ComposedModal/ComposedModal.stories.js | 101 ++ .../DatePicker/DatePicker.stories.js | 50 + .../components/Dropdown/Dropdown.stories.js | 50 + .../src/components/Modal/Modal.stories.js | 85 ++ .../MultiSelect/MultiSelect.stories.js | 64 ++ .../NumberInput/NumberInput.stories.js | 49 + .../RadioButton/RadioButton.stories.js | 112 +++ .../src/components/Select/Select.stories.js | 54 ++ .../react/src/components/Tag/Tag.stories.js | 73 +- .../components/TextArea/TextArea.stories.js | 46 +- .../components/TextInput/TextInput.stories.js | 45 + .../Tile/Tile.featureflag.stories.js | 89 ++ packages/react/src/components/Tile/Tile.mdx | 22 +- .../react/src/components/Tile/Tile.stories.js | 203 +++- 17 files changed, 1086 insertions(+), 897 deletions(-) delete mode 100644 packages/react/src/components/AILabel/Slug-examples.stories.js diff --git a/packages/react/src/components/AILabel/Slug-examples.stories.js b/packages/react/src/components/AILabel/Slug-examples.stories.js deleted file mode 100644 index ccf53fb47a2f..000000000000 --- a/packages/react/src/components/AILabel/Slug-examples.stories.js +++ /dev/null @@ -1,888 +0,0 @@ -import React, { useState } from 'react'; -import Button from '../Button'; -import Checkbox from '../Checkbox'; -import CheckboxGroup from '../CheckboxGroup'; -import ComboBox from '../ComboBox'; -import { - ComposedModal, - ModalBody, - ModalHeader, - ModalFooter, -} from '../ComposedModal'; -import DatePicker from '../DatePicker'; -import DatePickerInput from '../DatePickerInput'; -import Dropdown from '../Dropdown'; -import Modal from '../Modal'; -import { MultiSelect, FilterableMultiSelect } from '../MultiSelect'; -import { NumberInput } from '../NumberInput'; -import RadioButton from '../RadioButton'; -import RadioButtonGroup from '../RadioButtonGroup'; -import Select from '../Select'; -import SelectItem from '../SelectItem'; -import Tag from '../Tag'; -import TextArea from '../TextArea'; -import TextInput from '../TextInput'; -import { - ClickableTile, - ExpandableTile, - SelectableTile, - Tile, - TileAboveTheFoldContent, - TileBelowTheFoldContent, -} from '../Tile'; -import { default as RadioTile } from '../RadioTile'; -import TileGroup from '../TileGroup/TileGroup'; -import { FeatureFlags } from '../FeatureFlags'; -import { IconButton } from '../IconButton'; -import { - ArrowRight, - View, - FolderOpen, - Folders, - Asleep, -} from '@carbon/icons-react'; -import { AILabel, AILabelContent, AILabelActions } from '.'; -import './ailabel-story.scss'; -import mdx from './SlugExamples.mdx'; - -export default { - title: 'Experimental/unstable__Slug/Examples', - component: null, - parameters: { - docs: { - page: mdx, - }, - }, -}; - -const args = { - invalid: false, - invalidText: - 'Error message that is really long can wrap to more lines but should not be excessively long.', - disabled: false, - warn: false, - warnText: - 'Warning message that is really long can wrap to more lines but should not be excessively long.', -}; - -const argTypes = { - children: { - table: { - disable: true, - }, - }, - className: { - table: { - disable: true, - }, - }, - disabled: { - control: { - type: 'boolean', - }, - }, - invalid: { - control: { - type: 'boolean', - }, - }, - invalidText: { - control: { - type: 'text', - }, - }, - warn: { - control: { - type: 'boolean', - }, - }, - warnText: { - control: { - type: 'text', - }, - }, - slug: { - description: - '**Experimental**: Provide a `Slug` component to be rendered inside the component', - }, -}; - -const textareaProps = { - labelText: 'Text Area label', - className: 'some-class', - placeholder: 'Placeholder text', - id: 'test5', - rows: 4, -}; - -const TextInputProps = { - className: 'some-class', - id: 'test2', - labelText: 'Text Input label', - placeholder: 'Placeholder text', -}; - -const numberInputProps = { - className: 'some-class', - id: 'number-input-1', - label: 'Number Input', - min: 0, - max: 100, - value: 50, - step: 10, - iconDescription: 'Add/decrement number', -}; - -const items = [ - { - id: 'option-0', - text: 'Lorem, ipsum dolor sit amet consectetur adipisicing elit.', - }, - { - id: 'option-1', - text: 'Option 1', - }, - { - id: 'option-2', - text: 'Option 2', - }, - { - id: 'option-3', - text: 'Option 3 - a disabled item', - disabled: true, - }, - { - id: 'option-4', - text: 'Option 4', - }, - { - id: 'option-5', - text: 'Option 5', - }, -]; - -const aiLabel = ( - - -
-

AI Explained

-

84%

-

Confidence score

-

- Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut fsil labore et dolore magna aliqua. -

-
-

Model type

-

Foundation model

-
- - - - - - - - - - - - -
-
-); - -const slugFunc = (kind) => ( - - -
-

AI Explained

-

84%

-

Confidence score

-

- Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut fsil labore et dolore magna aliqua. -

-
-

Model type

-

Foundation model

-
- - - - - - - - - - - - -
-
-); - -export const _Checkbox = { - args: args, - argTypes: argTypes, - render: (args) => ( -
- - - - - - - - - - - - - - - - - -
- ), -}; - -export const _Combobox = { - args: args, - argTypes: argTypes, - render: (args) => ( -
- {}} - id="carbon-combobox" - items={items} - itemToString={(item) => (item ? item.text : '')} - titleText="ComboBox title" - helperText="Combobox helper text" - slug={slug} - {...args} - /> -
- ), -}; - -export const _ComposedModal = { - args: { - showButtons: true, - }, - argTypes: { - slug: { - description: - '**Experimental**: Provide a `Slug` component to be rendered inside the component', - }, - showButtons: { - description: 'Show or hide the Modal buttons', - }, - }, - render: (args) => { - const [open, setOpen] = useState(true); // eslint-disable-line - return ( -
- - setOpen(false)} slug={slug}> - - -

- Custom domains direct requests for your apps in this Cloud Foundry - organization to a URL that you own. A custom domain can be a - shared domain, a shared subdomain, or a shared domain and host. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus - eu nibh odio. Nunc a consequat est, id porttitor sapien. Proin - vitae leo vitae orci tincidunt auctor eget eget libero. Ut - tincidunt ultricies fringilla. Aliquam erat volutpat. Aenean arcu - odio, elementum vel vehicula vitae, porttitor ac lorem. Sed - viverra elit ac risus tincidunt fermentum. Ut sollicitudin nibh id - risus ornare ornare. Etiam gravida orci ut lectus dictum, quis - ultricies felis mollis. Mauris nec commodo est, nec faucibus nibh. - Nunc commodo ante quis pretium consectetur. Ut ac nisl vitae mi - mattis vulputate a at elit. Nullam porttitor ex eget mi feugiat - mattis. Nunc non sodales magna. Proin ornare tellus quis hendrerit - egestas. Donec pharetra leo nec molestie sollicitudin. -

- - - -

- Custom domains direct requests for your apps in this Cloud Foundry - organization to a URL that you own. A custom domain can be a - shared domain, a shared subdomain, or a shared domain and host. -

- -
- - {args.showButtons && ( - - )} -
-
- ); - }, -}; - -export const _DatePicker = { - args: args, - argTypes: argTypes, - render: (args) => ( -
- - - -
- ), -}; - -export const _Dropdown = { - args: args, - argTypes: argTypes, - render: (args) => ( -
- (item ? item.text : '')} - slug={slug} - {...args} - /> -
- ), -}; - -export const _FilterableMultiselect = { - args: args, - argTypes: argTypes, - render: (args) => ( -
- (item ? item.text : '')} - selectionFeedback="top-after-reopen" - slug={slug} - {...args} - /> -
- ), -}; - -export const _Modal = { - args: { - showButtons: true, - }, - argTypes: { - slug: { - description: - '**Experimental**: Provide a `Slug` component to be rendered inside the component', - }, - showButtons: { - description: 'Show or hide the Modal buttons', - }, - }, - render: (args) => { - const [open, setOpen] = useState(true); // eslint-disable-line - return ( -
- - setOpen(false)} - modalHeading="Add a custom domain" - modalLabel="Account resources" - primaryButtonText="Add" - secondaryButtonText="Cancel" - passiveModal={!args.showButtons} - slug={slug}> -

- Custom domains direct requests for your apps in this Cloud Foundry - organization to a URL that you own. A custom domain can be a shared - domain, a shared subdomain, or a shared domain and host. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus - eu nibh odio. Nunc a consequat est, id porttitor sapien. Proin vitae - leo vitae orci tincidunt auctor eget eget libero. Ut tincidunt - ultricies fringilla. Aliquam erat volutpat. Aenean arcu odio, - elementum vel vehicula vitae, porttitor ac lorem. Sed viverra elit - ac risus tincidunt fermentum. Ut sollicitudin nibh id risus ornare - ornare. Etiam gravida orci ut lectus dictum, quis ultricies felis - mollis. Mauris nec commodo est, nec faucibus nibh. Nunc commodo ante - quis pretium consectetur. Ut ac nisl vitae mi mattis vulputate a at - elit. Nullam porttitor ex eget mi feugiat mattis. Nunc non sodales - magna. Proin ornare tellus quis hendrerit egestas. Donec pharetra - leo nec molestie sollicitudin. -

- - -