From f54338a57a8c8bf204839ffa3b47d2c8f89d9b9b Mon Sep 17 00:00:00 2001 From: Sangeetha Babu <58620134+sangeethababu9223@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:31:48 +0530 Subject: [PATCH 01/14] feat(Tearsheet): slug to ai label --- .../src/components/Tearsheet/_tearsheet.scss | 16 +++++-- .../Tearsheet/Tearsheet.stories.jsx | 46 +++++++++---------- .../Tearsheet/TearsheetNarrow.stories.jsx | 34 +++++++------- .../Tearsheet/TearsheetShell.story.jsx | 31 ++++++------- .../components/Tearsheet/TearsheetShell.tsx | 24 +++++++--- 5 files changed, 84 insertions(+), 67 deletions(-) diff --git a/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss b/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss index c21a8a16cd..00de693190 100644 --- a/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss +++ b/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss @@ -110,6 +110,8 @@ $motion-duration: $duration-moderate-02; } &.#{$block-class}.#{$block-class}.#{$block-class}.#{$block-class}--has-slug + .#{$block-class}__container, + &.#{$block-class}.#{$block-class}.#{$block-class}.#{$block-class}--has-aiLabel .#{$block-class}__container { border: 1px solid transparent; border-bottom: 0; @@ -276,11 +278,15 @@ $motion-duration: $duration-moderate-02; &.#{$block-class}--wide .#{$block-class}__header.#{$block-class}__header--with-close-icon, - &.#{$block-class}--has-slug .#{$block-class}__header.#{$block-class}__header { + &.#{$block-class}--has-slug .#{$block-class}__header.#{$block-class}__header, + &.#{$block-class}--has-aiLabel + .#{$block-class}__header.#{$block-class}__header { padding-inline-end: $spacing-11; } &.#{$block-class}--wide.#{$block-class}--has-slug + .#{$block-class}__header.#{$block-class}__header--with-close-icon, + &.#{$block-class}--wide.#{$block-class}--has-aiLabel .#{$block-class}__header.#{$block-class}__header--with-close-icon { /* spacing 11 plus additional space for slug/close */ /* stylelint-disable-next-line carbon/layout-token-use */ @@ -362,7 +368,8 @@ $motion-duration: $duration-moderate-02; flex-grow: 1; } - &.#{$block-class}--has-slug .#{$block-class}__content { + &.#{$block-class}--has-slug .#{$block-class}__content, + &.#{$block-class}--has-aiLabel .#{$block-class}__content { @include utilities.ai-popover-gradient('default', 0); box-shadow: inset 0 -80px 70px -65px $ai-inner-shadow; @@ -418,12 +425,15 @@ $motion-duration: $duration-moderate-02; background: $background; } - &.#{$block-class}--has-slug { + &.#{$block-class}--has-slug, + &.#{$block-class}--has-aiLabel { /* stylelint-disable-next-line carbon/theme-token-use */ --overlay-color: #{$ai-overlay}; } &.#{$block-class}--has-slug:not(.#{$block-class}--has-close) + .#{$carbon-prefix}--slug, + &.#{$block-class}--has-aiLabel:not(.#{$block-class}--has-close) .#{$carbon-prefix}--slug { inset-inline-end: 0; margin-block: 6px; diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx index a873ce53be..52c7847831 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx @@ -23,8 +23,8 @@ import { TabPanel, TabList, TextInput, - unstable__Slug as Slug, - unstable__SlugContent as SlugContent, + AILabel, + AILabelContent, } from '@carbon/react'; import { Tearsheet, deprecatedProps } from './Tearsheet'; @@ -102,12 +102,12 @@ export default { navigation: { control: { disable: true } }, open: { control: { disable: true } }, portalTarget: { control: { disable: true } }, - slug: { + aiLabel: { control: { type: 'select', labels: { - 0: 'No AI slug', - 1: 'with AI Slug', + 0: 'No AI Label', + 1: 'with AI Label', }, default: 0, }, @@ -158,9 +158,9 @@ const mainContent = ( const title = 'Title of the tearsheet'; -const sampleSlug = ( - - +const sampleAILabel = ( + +

AI Explained

84%

@@ -174,13 +174,13 @@ const sampleSlug = (

Model type

Foundation model

-
-
+ + ); // Template. // eslint-disable-next-line react/prop-types -const Template = ({ actions, slug, ...args }) => { +const Template = ({ actions, aiLabel, ...args }) => { const [open, setOpen] = useState(false); const wiredActions = @@ -211,7 +211,7 @@ const Template = ({ actions, slug, ...args }) => { actions={wiredActions} open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} > {mainContent} @@ -231,7 +231,7 @@ const tabs = ( ); -const TemplateWithNav = ({ actions, slug, ...args }) => { +const TemplateWithNav = ({ actions, aiLabel, ...args }) => { const [open, setOpen] = useState(false); const wiredActions = @@ -263,7 +263,7 @@ const TemplateWithNav = ({ actions, slug, ...args }) => { actions={wiredActions} open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} > Tab 1 @@ -278,7 +278,7 @@ const TemplateWithNav = ({ actions, slug, ...args }) => { ); }; -const ReturnFocusTemplate = ({ actions, slug, ...args }) => { +const ReturnFocusTemplate = ({ actions, aiLabel, ...args }) => { const [open, setOpen] = useState(false); const buttonRef = useRef(); @@ -312,7 +312,7 @@ const ReturnFocusTemplate = ({ actions, slug, ...args }) => { actions={wiredActions} open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} launcherButtonRef={buttonRef} > {mainContent} @@ -322,7 +322,7 @@ const ReturnFocusTemplate = ({ actions, slug, ...args }) => { ); }; -const FirstElementDisabledTemplate = ({ actions, slug, ...args }) => { +const FirstElementDisabledTemplate = ({ actions, aiLabel, ...args }) => { const [open, setOpen] = useState(false); const wiredActions = @@ -353,7 +353,7 @@ const FirstElementDisabledTemplate = ({ actions, slug, ...args }) => { actions={wiredActions} open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} >
@@ -389,7 +389,7 @@ const FirstElementDisabledTemplate = ({ actions, slug, ...args }) => { }; // eslint-disable-next-line react/prop-types -const StackedTemplate = ({ mixedSizes, actions, slug, ...args }) => { +const StackedTemplate = ({ mixedSizes, actions, aiLabel, ...args }) => { const [open1, setOpen1] = useState(false); const [open2, setOpen2] = useState(false); const [open3, setOpen3] = useState(false); @@ -485,7 +485,7 @@ const StackedTemplate = ({ mixedSizes, actions, slug, ...args }) => { open={open1} onClose={() => setOpen1(false)} selectorPrimaryFocus="#stacked-input-1" - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} >
Main content 1 @@ -515,7 +515,7 @@ const StackedTemplate = ({ mixedSizes, actions, slug, ...args }) => { open={open2} onClose={() => setOpen2(false)} selectorPrimaryFocus="#stacked-input-2" - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} >
Main content 2 @@ -533,7 +533,7 @@ const StackedTemplate = ({ mixedSizes, actions, slug, ...args }) => { open={open3} onClose={() => setOpen3(false)} selectorPrimaryFocus="#stacked-input-3" - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} >
Main content 3 @@ -622,7 +622,7 @@ fullyLoaded.args = { onClose: action('onClose called'), title, actions: 0, - slug: 1, + aiLabel: 1, }; // eslint-disable-next-line react/prop-types diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx index 91e5145cb9..508d5bdd16 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx @@ -16,8 +16,8 @@ import { Form, FormGroup, TextInput, - unstable__Slug as Slug, - unstable__SlugContent as SlugContent, + AILabel, + AILabelContent, } from '@carbon/react'; import { TearsheetNarrow, deprecatedProps } from './TearsheetNarrow'; @@ -59,12 +59,12 @@ export default { onClose: { control: { disable: true } }, open: { control: { disable: true } }, portalTarget: { control: { disable: true } }, - slug: { + aiLabel: { control: { type: 'select', labels: { - 0: 'No AI slug', - 1: 'with AI Slug', + 0: 'No AI Label', + 1: 'with AI Label', }, default: 0, }, @@ -99,9 +99,9 @@ const mainContent = ( const title = 'Title of the tearsheet'; -const sampleSlug = ( - - +const sampleAILabel = ( + +

AI Explained

84%

@@ -115,13 +115,13 @@ const sampleSlug = (

Model type

Foundation model

-
-
+ + ); // Template. // eslint-disable-next-line react/prop-types -const Template = ({ actions, slug, ...args }) => { +const Template = ({ actions, aiLabel, ...args }) => { const [open, setOpen] = useState(false); const ref = useRef(); @@ -149,7 +149,7 @@ const Template = ({ actions, slug, ...args }) => { actions={wiredActions} open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} > {mainContent} @@ -159,7 +159,7 @@ const Template = ({ actions, slug, ...args }) => { }; // eslint-disable-next-line react/prop-types -const StackedTemplate = ({ actions, slug, ...args }) => { +const StackedTemplate = ({ actions, aiLabel, ...args }) => { const [open1, setOpen1] = useState(false); const [open2, setOpen2] = useState(false); const [open3, setOpen3] = useState(false); @@ -231,7 +231,7 @@ const StackedTemplate = ({ actions, slug, ...args }) => { title="Tearsheet #1" open={open1} onClose={() => setOpen1(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} >
Main content 1 @@ -243,7 +243,7 @@ const StackedTemplate = ({ actions, slug, ...args }) => { title="Tearsheet #2" open={open2} onClose={() => setOpen2(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} selectorPrimaryFocus="#main-content" >
@@ -256,7 +256,7 @@ const StackedTemplate = ({ actions, slug, ...args }) => { title="Tearsheet #3" open={open3} onClose={() => setOpen3(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} selectorPrimaryFocus="#main-content" >
@@ -289,7 +289,7 @@ fullyLoaded.args = { onClose: action('onClose called'), title, actions: 0, - slug: 1, + aiLabel: 1, }; export const stacked = StackedTemplate.bind({}); diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx index 9f6a1a6b72..feeeff88b1 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx @@ -12,12 +12,7 @@ import { createPortal } from 'react-dom'; import styles from './_storybook-styles.scss?inline'; import { TearsheetShell, deprecatedProps } from './TearsheetShell'; import { getDeprecatedArgTypes } from '../../global/js/utils/props-helper'; -import { - Button, - unstable__Slug as Slug, - unstable__SlugContent as SlugContent, - TextInput, -} from '@carbon/react'; +import { Button, AILabel, AILabelContent, TextInput } from '@carbon/react'; // import mdx from './TearsheetShell.mdx'; @@ -37,12 +32,12 @@ export default { }, }, portalTarget: { control: { disable: true } }, - slug: { + aiLabel: { control: { type: 'select', labels: { - 0: 'No AI slug', - 1: 'with AI Slug', + 0: 'No AI Label', + 1: 'with AI Label', }, default: 0, }, @@ -76,9 +71,9 @@ const dummyContent = (
); -const sampleSlug = ( - - +const sampleAILabel = ( + +

AI Explained

84%

@@ -92,12 +87,12 @@ const sampleSlug = (

Model type

Foundation model

-
-
+ + ); // Template. -const Template = ({ influencer, open: _open, slug, ...args }, context) => { +const Template = ({ influencer, open: _open, aiLabel, ...args }, context) => { const ref = useRef(); const [open, setOpen] = useState(context.viewMode !== 'docs' && _open); const [beenOpen, setBeenOpen] = useState(false); @@ -120,7 +115,7 @@ const Template = ({ influencer, open: _open, slug, ...args }, context) => { } open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} title={'Tearsheet title'} > {dummyContent} @@ -130,7 +125,7 @@ const Template = ({ influencer, open: _open, slug, ...args }, context) => { }; const ReturnFocusTemplate = ( - { influencer, open: _open, slug, ...args }, + { influencer, open: _open, aiLabel, ...args }, context ) => { const ref = useRef(); @@ -156,7 +151,7 @@ const ReturnFocusTemplate = ( } open={open} onClose={() => setOpen(false)} - slug={slug && sampleSlug} + aiLabel={aiLabel && sampleAILabel} title={'Tearsheet title'} launcherButtonRef={buttonRef} > diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index 3ecf47fab4..1fdad080c3 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -25,7 +25,7 @@ import cx from 'classnames'; import { pkg } from '../../settings'; import pconsole from '../../global/js/utils/pconsole'; import { getNodeTextContent } from '../../global/js/utils/getNodeTextContent'; - +import { deprecateProp } from '../../global/js/utils/props-helper'; // Carbon and package components we use. import { Button, @@ -156,10 +156,15 @@ interface TearsheetShellProps extends PropsWithChildren { size: 'narrow' | 'wide'; /** - * **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component + * @deprecated **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component */ slug?: ReactNode; + /** + * Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level. + */ + aiLabel: ReactNode; + /** * The main title of the tearsheet, displayed in the header area. */ @@ -230,6 +235,7 @@ export const TearsheetShell = React.forwardRef( { // The component props, in alphabetical order (for consistency). actions, + aiLabel, ariaLabel, children, className, @@ -248,7 +254,7 @@ export const TearsheetShell = React.forwardRef( selectorPrimaryFocus, selectorsFloatingMenus = [], size, - slug, + slug: deprecated_slug, title, verticalPosition, launcherButtonRef, @@ -472,10 +478,11 @@ export const TearsheetShell = React.forwardRef( depth > 1 || (depth === 1 && (prevDepth?.current ?? 0) > 1), [`${bc}--wide`]: wide, [`${bc}--narrow`]: !wide, - [`${bc}--has-slug`]: slug, + [`${bc}--has-slug`]: deprecated_slug, + [`${bc}--has-aiLabel`]: aiLabel, [`${bc}--has-close`]: effectiveHasCloseIcon, })} - slug={slug} + slug={aiLabel ? aiLabel : deprecated_slug} style={setScaleValues()} containerClassName={cx(`${bc}__container`, { [`${bc}__container--lower`]: verticalPosition === 'lower', @@ -664,6 +671,11 @@ TearsheetShell.propTypes = { }) ), + /** + * Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level. + */ + aiLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]), + /** * The main content of the tearsheet. */ @@ -789,7 +801,7 @@ TearsheetShell.propTypes = { /** * **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component */ - slug: PropTypes.node, + slug: deprecateProp(PropTypes.node, 'Property replaced by `aiLabel`'), /** * The main title of the tearsheet, displayed in the header area. From 245ae9d9d03bdb2051456e932e2ab51c4334582d Mon Sep 17 00:00:00 2001 From: Sangeetha Babu <58620134+sangeethababu9223@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:34:01 +0530 Subject: [PATCH 02/14] feat(tearsheet): update cspell --- cspell.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cspell.json b/cspell.json index 11e98c1111..7ff2a2f86f 100644 --- a/cspell.json +++ b/cspell.json @@ -64,6 +64,7 @@ ], "words": [ "aboutmodal", + "accountibility", "actionbar", "apikey", "apikeymodal", @@ -91,6 +92,7 @@ "disttags", "dragbar", "draggable", + "explainability", "interstitialscreenviewmodule", "draghandle", "dragmode", @@ -145,6 +147,7 @@ "rowindex", "ruleset", "sbdocs", + "scenerio", "scrollend", "semibold", "serializers", From d135f4239db57aed225e96d068079c6bf6e5078e Mon Sep 17 00:00:00 2001 From: Sangeetha Babu <58620134+sangeethababu9223@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:00:05 +0530 Subject: [PATCH 03/14] feat(Tearsheet): deprecation message update --- .../Tearsheet/Tearsheet.stories.jsx | 33 +++++++++++---- .../Tearsheet/TearsheetNarrow.stories.jsx | 22 +++++++++- .../components/Tearsheet/TearsheetShell.tsx | 40 ++++++++++--------- 3 files changed, 67 insertions(+), 28 deletions(-) diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx index 52c7847831..928799a85a 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx @@ -111,6 +111,20 @@ export default { }, default: 0, }, + description: + 'Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level.', + options: [0, 1], + }, + slug: { + control: { + type: 'select', + labels: { + 0: 'No AI Slug', + 1: 'with AI Slug', + }, + default: 0, + }, + description: 'deprecated Property replaced by "aiLabel"', options: [0, 1], }, }, @@ -180,7 +194,7 @@ const sampleAILabel = ( // Template. // eslint-disable-next-line react/prop-types -const Template = ({ actions, aiLabel, ...args }) => { +const Template = ({ actions, aiLabel, slug, ...args }) => { const [open, setOpen] = useState(false); const wiredActions = @@ -212,6 +226,7 @@ const Template = ({ actions, aiLabel, ...args }) => { open={open} onClose={() => setOpen(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} > {mainContent} @@ -231,7 +246,7 @@ const tabs = (
); -const TemplateWithNav = ({ actions, aiLabel, ...args }) => { +const TemplateWithNav = ({ actions, aiLabel, slug, ...args }) => { const [open, setOpen] = useState(false); const wiredActions = @@ -264,6 +279,7 @@ const TemplateWithNav = ({ actions, aiLabel, ...args }) => { open={open} onClose={() => setOpen(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} > Tab 1 @@ -278,7 +294,7 @@ const TemplateWithNav = ({ actions, aiLabel, ...args }) => { ); }; -const ReturnFocusTemplate = ({ actions, aiLabel, ...args }) => { +const ReturnFocusTemplate = ({ actions, aiLabel, slug, ...args }) => { const [open, setOpen] = useState(false); const buttonRef = useRef(); @@ -313,6 +329,7 @@ const ReturnFocusTemplate = ({ actions, aiLabel, ...args }) => { open={open} onClose={() => setOpen(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} launcherButtonRef={buttonRef} > {mainContent} @@ -322,9 +339,8 @@ const ReturnFocusTemplate = ({ actions, aiLabel, ...args }) => { ); }; -const FirstElementDisabledTemplate = ({ actions, aiLabel, ...args }) => { +const FirstElementDisabledTemplate = ({ actions, aiLabel, slug, ...args }) => { const [open, setOpen] = useState(false); - const wiredActions = actions && Array.prototype.map.call(actions, (action) => { @@ -340,7 +356,6 @@ const FirstElementDisabledTemplate = ({ actions, aiLabel, ...args }) => { } return action; }); - const ref = useRef(); return ( @@ -354,6 +369,7 @@ const FirstElementDisabledTemplate = ({ actions, aiLabel, ...args }) => { open={open} onClose={() => setOpen(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} >
@@ -389,7 +405,7 @@ const FirstElementDisabledTemplate = ({ actions, aiLabel, ...args }) => { }; // eslint-disable-next-line react/prop-types -const StackedTemplate = ({ mixedSizes, actions, aiLabel, ...args }) => { +const StackedTemplate = ({ mixedSizes, actions, aiLabel, slug, ...args }) => { const [open1, setOpen1] = useState(false); const [open2, setOpen2] = useState(false); const [open3, setOpen3] = useState(false); @@ -486,6 +502,7 @@ const StackedTemplate = ({ mixedSizes, actions, aiLabel, ...args }) => { onClose={() => setOpen1(false)} selectorPrimaryFocus="#stacked-input-1" aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} >
Main content 1 @@ -516,6 +533,7 @@ const StackedTemplate = ({ mixedSizes, actions, aiLabel, ...args }) => { onClose={() => setOpen2(false)} selectorPrimaryFocus="#stacked-input-2" aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} >
Main content 2 @@ -534,6 +552,7 @@ const StackedTemplate = ({ mixedSizes, actions, aiLabel, ...args }) => { onClose={() => setOpen3(false)} selectorPrimaryFocus="#stacked-input-3" aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} >
Main content 3 diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx index 508d5bdd16..914f4fd51c 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx @@ -68,6 +68,20 @@ export default { }, default: 0, }, + description: + 'Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level.', + options: [0, 1], + }, + slug: { + control: { + type: 'select', + labels: { + 0: 'No AI Slug', + 1: 'with AI Slug', + }, + default: 0, + }, + description: 'deprecated Property replaced by "aiLabel"', options: [0, 1], }, }, @@ -121,7 +135,7 @@ const sampleAILabel = ( // Template. // eslint-disable-next-line react/prop-types -const Template = ({ actions, aiLabel, ...args }) => { +const Template = ({ actions, aiLabel, slug, ...args }) => { const [open, setOpen] = useState(false); const ref = useRef(); @@ -150,6 +164,7 @@ const Template = ({ actions, aiLabel, ...args }) => { open={open} onClose={() => setOpen(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} > {mainContent} @@ -159,7 +174,7 @@ const Template = ({ actions, aiLabel, ...args }) => { }; // eslint-disable-next-line react/prop-types -const StackedTemplate = ({ actions, aiLabel, ...args }) => { +const StackedTemplate = ({ actions, aiLabel, slug, ...args }) => { const [open1, setOpen1] = useState(false); const [open2, setOpen2] = useState(false); const [open3, setOpen3] = useState(false); @@ -232,6 +247,7 @@ const StackedTemplate = ({ actions, aiLabel, ...args }) => { open={open1} onClose={() => setOpen1(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} >
Main content 1 @@ -244,6 +260,7 @@ const StackedTemplate = ({ actions, aiLabel, ...args }) => { open={open2} onClose={() => setOpen2(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} selectorPrimaryFocus="#main-content" >
@@ -257,6 +274,7 @@ const StackedTemplate = ({ actions, aiLabel, ...args }) => { open={open3} onClose={() => setOpen3(false)} aiLabel={aiLabel && sampleAILabel} + slug={slug && sampleAILabel} selectorPrimaryFocus="#main-content" >
diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index 1fdad080c3..5f303be5af 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -52,6 +52,12 @@ const maxDepth = 3; interface TearsheetShellProps extends PropsWithChildren { actions?: ButtonProps<'button'>[]; + /** + * Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, + * accountibility, and explainability at the UI level. + */ + aiLabel?: ReactNode; + ariaLabel?: string; /** @@ -155,22 +161,18 @@ interface TearsheetShellProps extends PropsWithChildren { */ size: 'narrow' | 'wide'; - /** - * @deprecated **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component - */ - slug?: ReactNode; - - /** - * Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level. - */ - aiLabel: ReactNode; - /** * The main title of the tearsheet, displayed in the header area. */ title?: ReactNode; verticalPosition?: 'normal' | 'lower'; + + // Deprecated props + /** + * @deprecated Property replaced by `aiLabel` + */ + slug?: ReactNode; } export type CloseIconDescriptionTypes = @@ -459,6 +461,7 @@ export const TearsheetShell = React.forwardRef( [`--${bc}--stacking-scale-factor-double`]: (width - 64) / width, }; }; + console.log(typeof aiLabel, 'type of aiLabel'); return renderPortalUse( Date: Wed, 9 Oct 2024 18:04:19 +0530 Subject: [PATCH 04/14] feat(Tearsheet): remove log --- .../ibm-products/src/components/Tearsheet/TearsheetShell.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index 5f303be5af..92ca486090 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -461,8 +461,6 @@ export const TearsheetShell = React.forwardRef( [`--${bc}--stacking-scale-factor-double`]: (width - 64) / width, }; }; - console.log(typeof aiLabel, 'type of aiLabel'); - return renderPortalUse( Date: Wed, 9 Oct 2024 18:33:35 +0530 Subject: [PATCH 05/14] feat(Tearsheet): test case fail fix --- e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js b/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js index d657f043da..48be113e3e 100644 --- a/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js +++ b/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js @@ -168,7 +168,7 @@ test.describe('TearsheetNarrow @avt', () => { await expect(page).toHaveNoACViolations( 'TearsheetNarrow @avt-all-header-items' ); - await expect(page.locator('.slug-container')).toBeInViewport(); + await expect(page.locator('.aiLabel-container')).toBeInViewport(); // Selecting the first slug button const slugButton1 = page From 35137e11d7be92149f9e9e7fcd590d2b28015e6d Mon Sep 17 00:00:00 2001 From: Sangeetha Babu <58620134+sangeethababu9223@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:08:35 +0530 Subject: [PATCH 06/14] feat(Tearsheet): aiLabel classes updated per core carbon --- .../Tearsheet/TearsheetNarrow-test.avt.e2e.js | 2 +- .../src/components/Tearsheet/_tearsheet.scss | 12 ++++++------ .../src/components/Tearsheet/Tearsheet.stories.jsx | 2 +- .../components/Tearsheet/TearsheetNarrow.stories.jsx | 2 +- .../components/Tearsheet/TearsheetShell.story.jsx | 2 +- .../src/components/Tearsheet/TearsheetShell.tsx | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js b/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js index 48be113e3e..0cc3222f74 100644 --- a/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js +++ b/e2e/components/Tearsheet/TearsheetNarrow-test.avt.e2e.js @@ -168,7 +168,7 @@ test.describe('TearsheetNarrow @avt', () => { await expect(page).toHaveNoACViolations( 'TearsheetNarrow @avt-all-header-items' ); - await expect(page.locator('.aiLabel-container')).toBeInViewport(); + await expect(page.locator('.ai-label-container')).toBeInViewport(); // Selecting the first slug button const slugButton1 = page diff --git a/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss b/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss index 00de693190..ae573cc8cd 100644 --- a/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss +++ b/packages/ibm-products-styles/src/components/Tearsheet/_tearsheet.scss @@ -111,7 +111,7 @@ $motion-duration: $duration-moderate-02; &.#{$block-class}.#{$block-class}.#{$block-class}.#{$block-class}--has-slug .#{$block-class}__container, - &.#{$block-class}.#{$block-class}.#{$block-class}.#{$block-class}--has-aiLabel + &.#{$block-class}.#{$block-class}.#{$block-class}.#{$block-class}--has-ai-label .#{$block-class}__container { border: 1px solid transparent; border-bottom: 0; @@ -279,14 +279,14 @@ $motion-duration: $duration-moderate-02; &.#{$block-class}--wide .#{$block-class}__header.#{$block-class}__header--with-close-icon, &.#{$block-class}--has-slug .#{$block-class}__header.#{$block-class}__header, - &.#{$block-class}--has-aiLabel + &.#{$block-class}--has-ai-label .#{$block-class}__header.#{$block-class}__header { padding-inline-end: $spacing-11; } &.#{$block-class}--wide.#{$block-class}--has-slug .#{$block-class}__header.#{$block-class}__header--with-close-icon, - &.#{$block-class}--wide.#{$block-class}--has-aiLabel + &.#{$block-class}--wide.#{$block-class}--has-ai-label .#{$block-class}__header.#{$block-class}__header--with-close-icon { /* spacing 11 plus additional space for slug/close */ /* stylelint-disable-next-line carbon/layout-token-use */ @@ -369,7 +369,7 @@ $motion-duration: $duration-moderate-02; } &.#{$block-class}--has-slug .#{$block-class}__content, - &.#{$block-class}--has-aiLabel .#{$block-class}__content { + &.#{$block-class}--has-ai-label .#{$block-class}__content { @include utilities.ai-popover-gradient('default', 0); box-shadow: inset 0 -80px 70px -65px $ai-inner-shadow; @@ -426,14 +426,14 @@ $motion-duration: $duration-moderate-02; } &.#{$block-class}--has-slug, - &.#{$block-class}--has-aiLabel { + &.#{$block-class}--has-ai-label { /* stylelint-disable-next-line carbon/theme-token-use */ --overlay-color: #{$ai-overlay}; } &.#{$block-class}--has-slug:not(.#{$block-class}--has-close) .#{$carbon-prefix}--slug, - &.#{$block-class}--has-aiLabel:not(.#{$block-class}--has-close) + &.#{$block-class}--has-ai-label:not(.#{$block-class}--has-close) .#{$carbon-prefix}--slug { inset-inline-end: 0; margin-block: 6px; diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx index 928799a85a..3666150ca5 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx @@ -173,7 +173,7 @@ const mainContent = ( const title = 'Title of the tearsheet'; const sampleAILabel = ( - +

AI Explained

diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx index 914f4fd51c..4385834139 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx @@ -114,7 +114,7 @@ const mainContent = ( const title = 'Title of the tearsheet'; const sampleAILabel = ( - +

AI Explained

diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx index feeeff88b1..077d068eae 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.story.jsx @@ -72,7 +72,7 @@ const dummyContent = ( ); const sampleAILabel = ( - +

AI Explained

diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index 92ca486090..a95d5f7186 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -480,7 +480,7 @@ export const TearsheetShell = React.forwardRef( [`${bc}--wide`]: wide, [`${bc}--narrow`]: !wide, [`${bc}--has-slug`]: deprecated_slug, - [`${bc}--has-aiLabel`]: aiLabel, + [`${bc}--has-ai-label`]: aiLabel, [`${bc}--has-close`]: effectiveHasCloseIcon, })} slug={aiLabel || deprecated_slug} From 6eb4e2a5bf0e13102c2160031a9177d92550f7ca Mon Sep 17 00:00:00 2001 From: Sangeetha Babu <58620134+sangeethababu9223@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:29:45 +0530 Subject: [PATCH 07/14] feat(Tearhseet): story control update --- .../ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx | 1 + .../src/components/Tearsheet/TearsheetNarrow.stories.jsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx index 3666150ca5..6d0cf9a30d 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx @@ -642,6 +642,7 @@ fullyLoaded.args = { title, actions: 0, aiLabel: 1, + slug: 0, }; // eslint-disable-next-line react/prop-types diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx index 4385834139..ea66bb3fdf 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx @@ -308,6 +308,7 @@ fullyLoaded.args = { title, actions: 0, aiLabel: 1, + slug: 0, }; export const stacked = StackedTemplate.bind({}); From 746d022fca6c9f1f487becc7a15e8aa6fcd6874b Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Fri, 18 Oct 2024 10:16:30 +0530 Subject: [PATCH 08/14] Update cspell.json Spelling issues Co-authored-by: elysia --- cspell.json | 1 - 1 file changed, 1 deletion(-) diff --git a/cspell.json b/cspell.json index bafe07fff6..027b279f73 100644 --- a/cspell.json +++ b/cspell.json @@ -64,7 +64,6 @@ ], "words": [ "aboutmodal", - "accountibility", "actionbar", "apikey", "apikeymodal", From 489c4d781ea7dc93d60a7d540a7e72b250c453dd Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Fri, 18 Oct 2024 10:16:47 +0530 Subject: [PATCH 09/14] Update cspell.json Spelling issues Co-authored-by: elysia --- cspell.json | 1 - 1 file changed, 1 deletion(-) diff --git a/cspell.json b/cspell.json index 027b279f73..ab24962bc0 100644 --- a/cspell.json +++ b/cspell.json @@ -156,7 +156,6 @@ "rowindex", "ruleset", "sbdocs", - "scenerio", "scrollend", "semibold", "serializers", From 32cc5bb4b2ba53e1b52dff4a61afd345a05e7598 Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Fri, 18 Oct 2024 10:17:10 +0530 Subject: [PATCH 10/14] Update packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx Spelling issues Co-authored-by: elysia --- .../ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx index 6d0cf9a30d..5c37794227 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx @@ -112,7 +112,7 @@ export default { default: 0, }, description: - 'Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level.', + 'Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.', options: [0, 1], }, slug: { From e83df2026780b86c14dda70c274a73ecb0d51d55 Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Fri, 18 Oct 2024 10:17:35 +0530 Subject: [PATCH 11/14] Update packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx text case update Co-authored-by: elysia --- .../ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx index 5c37794227..d47d981e8a 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.stories.jsx @@ -124,7 +124,7 @@ export default { }, default: 0, }, - description: 'deprecated Property replaced by "aiLabel"', + description: 'Deprecated: Property replaced by "aiLabel"', options: [0, 1], }, }, From a072cf1029252cad4e55c4a66b45ce2c766fc354 Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Fri, 18 Oct 2024 10:17:50 +0530 Subject: [PATCH 12/14] Update packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx Spelling issues Co-authored-by: elysia --- .../ibm-products/src/components/Tearsheet/TearsheetShell.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index a95d5f7186..a3c7a3366e 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -53,8 +53,8 @@ interface TearsheetShellProps extends PropsWithChildren { actions?: ButtonProps<'button'>[]; /** - * Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, - * accountibility, and explainability at the UI level. + * Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, + * accountability, and explainability at the UI level. */ aiLabel?: ReactNode; From 1c0d8420b9946d15b5e3b87ed4bf6ee64c05ba37 Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Fri, 18 Oct 2024 10:17:57 +0530 Subject: [PATCH 13/14] Update packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx Spelling issues Co-authored-by: elysia --- .../ibm-products/src/components/Tearsheet/TearsheetShell.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index a3c7a3366e..4bd8e48769 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -678,8 +678,8 @@ TearsheetShell.propTypes = { ), /** - * Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, - * accountibility, and explainability at the UI level. + * Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, + * accountability, and explainability at the UI level. */ aiLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]), From 2aa3ba2ed36d124c9ca2f3e858a3cc84a1f0cdfc Mon Sep 17 00:00:00 2001 From: Sangeetha Babu <58620134+sangeethababu9223@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:40:23 +0530 Subject: [PATCH 14/14] fix(Tearsheet): spelling issue fix --- .../src/components/Tearsheet/TearsheetNarrow.stories.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx index ea66bb3fdf..373e78d381 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.stories.jsx @@ -69,7 +69,7 @@ export default { default: 0, }, description: - 'Optional prop that is intended for any scenerio where something is being generated by AI to reinforce AI transparency, accountibility, and explainability at the UI level.', + 'Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.', options: [0, 1], }, slug: {