-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Al label component #4133
Merged
kodiakhq
merged 17 commits into
carbon-design-system:main
from
aagonzales:ai-label-component
Jul 12, 2024
Merged
docs: Al label component #4133
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
18dc0dd
docs: Al label component
aagonzales 928dcac
Content and image updates
aagonzales 93053c6
updated-images
aagonzales 6a85c76
Added-style-tab
aagonzales fc3ca71
added-style-images
aagonzales b37c213
Added-accessibility-content
aagonzales 24be413
Merge branch 'main' into ai-label-component
aagonzales 1e4beab
Merge branch 'main' into ai-label-component
aagonzales 76b8d45
Add-link-to-ai-overview
aagonzales 472d1ab
Updates from review
aagonzales 9aaf0fe
Merge branch 'main' into ai-label-component
aagonzales 8925df8
Update style.mdx
aagonzales aa48b51
Merge branch 'ai-label-component' of https://github.com/aagonzales/ca…
aagonzales 940d3d6
Updates from Gower's review
aagonzales 8a869b6
additonal-a11y-content
aagonzales 04cce24
final-a11y-edits
aagonzales 8158352
Merge branch 'main' into ai-label-component
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: AI label | ||
description: The AI label indicates an instance of AI in the UI. | ||
tabs: ['Usage', 'Style', 'Code', 'Accessibility'] | ||
--- | ||
|
||
<PageDescription> | ||
|
||
The AI label display and hide explainability information upon the click of the | ||
UI trigger element and can contain interactive elements. | ||
|
||
</PageDescription> | ||
|
||
<AnchorLinks> | ||
|
||
<AnchorLink>What Carbon provides</AnchorLink> | ||
<AnchorLink>Development considerations</AnchorLink> | ||
|
||
</AnchorLinks> | ||
|
||
## What Carbon provides | ||
|
||
Carbon already incorporates accessibility into the AI label component. | ||
|
||
### Keyboard interactions | ||
|
||
AI labels use the AI icon for the trigger button. These buttons are in the tab | ||
order and are activated by pressing `Enter` or `Space`. The activation toggles | ||
the popover open and closed, and focus remains on the trigger. | ||
|
||
When the popover contains interactive elements, pressing `Tab` will move focus | ||
to the first component in the popover. When the popover only has non-interactive | ||
text, or when the focus is on the last component in the popover, pressing `Tab` | ||
will close the popover and move focus to the next tab stop on the page. Pressing | ||
`Esc` also closes an open popover and returns focus to the trigger if the focus | ||
is inside the popover. | ||
|
||
<Row> | ||
<Column colLg={12}> | ||
|
||
![Diagram of AI label keyboard interaction](images/ai-label-accessibility-1.png) | ||
|
||
<Caption> | ||
The AI label icon button that triggers the popover is in the page tab order, | ||
as are interactive elements inside an open popover. | ||
</Caption> | ||
|
||
</Column> | ||
</Row> | ||
|
||
<Row> | ||
<Column colLg={12}> | ||
|
||
![Diagram of AI label keyboard interaction](images/ai-label-accessibility-2.png) | ||
|
||
<Caption> | ||
AI explainability popovers appear when the AI label icon button is activated | ||
and disappears by activating the icon again, pressing Esc, or tabbing away | ||
from the popover. | ||
</Caption> | ||
|
||
</Column> | ||
</Row> | ||
|
||
## Development considerations | ||
|
||
Keep these considerations in mind if you are modifying Carbon or creating a | ||
custom component. | ||
|
||
- The icon button has `aria-label="AI - Show information"`. | ||
- The button uses `aria-expanded` to set toggletip visibility and | ||
`aria-controls` to handle navigation to the content. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: AI label | ||
description: The AI label indicates an instance of AI in the UI. | ||
tabs: ['Usage', 'Style', 'Code', 'Accessibility'] | ||
--- | ||
|
||
<PageDescription> | ||
|
||
Preview the AI label component with the React live demo. For detailed code usage | ||
documentation, see the Storybooks for each framework below. | ||
|
||
</PageDescription> | ||
|
||
## Documentation | ||
|
||
<Row className="resource-card-group"> | ||
<Column colLg={4} colMd={4} noGutterSm> | ||
<ResourceCard | ||
subTitle="React" | ||
href="https://react.carbondesignsystem.com/?path=/docs/experimental-unstable-slug--overview" | ||
> | ||
|
||
<MdxIcon name="react" /> | ||
|
||
</ResourceCard> | ||
</Column> | ||
<Column colLg={4} colMd={4} noGutterSm> | ||
<ResourceCard | ||
subTitle="Web Components" | ||
href="https://web-components.carbondesignsystem.com/?path=/story/experimental-slug--default" | ||
> | ||
|
||
<MdxIcon name="webcomponents" /> | ||
|
||
</ResourceCard> | ||
</Column> | ||
</Row> | ||
|
||
## Live demo | ||
|
||
<InlineNotification> | ||
|
||
The live demo for AI label will be added soon. Check back later for updates. | ||
|
||
</InlineNotification> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+200 KB
src/pages/components/ai-label/images/ai-label-explainability-anatomy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+492 KB
src/pages/components/ai-label/images/ai-label-explainability-orientation.png
aagonzales marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
aagonzales marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.2 KB
src/pages/components/ai-label/images/ai-label-placement-containers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.4 KB
src/pages/components/ai-label/images/ai-label-placement-data-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
src/pages/components/ai-label/images/ai-label-placement-icons-exception.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+260 KB
src/pages/components/ai-label/images/style-ai-label-explainability-structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+230 KB
src/pages/components/ai-label/images/style-ai-label-explainability.png
Oops, something went wrong.
Binary file added
BIN
+5.75 KB
src/pages/components/ai-label/images/style-ai-label-states-default.png
Oops, something went wrong.
Binary file added
BIN
+6.05 KB
src/pages/components/ai-label/images/style-ai-label-states-inline.png
Oops, something went wrong.
Binary file added
BIN
+19.9 KB
src/pages/components/ai-label/images/style-ai-label-structure-default.png
Oops, something went wrong.
Binary file added
BIN
+13.9 KB
src/pages/components/ai-label/images/style-ai-label-structure-inline.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
--- | ||
title: AI label | ||
description: The AI label indicates an instance of AI in the UI. | ||
tabs: ['Usage', 'Style', 'Code', 'Accessibility'] | ||
--- | ||
|
||
<PageDescription> | ||
|
||
The following page documents visual specifications such as color, typography, | ||
structure, and sizes. | ||
|
||
</PageDescription> | ||
|
||
<AnchorLinks> | ||
|
||
<AnchorLink>Color</AnchorLink> | ||
<AnchorLink>Typography</AnchorLink> | ||
<AnchorLink>Structure</AnchorLink> | ||
<AnchorLink>Sizes</AnchorLink> | ||
|
||
</AnchorLinks> | ||
|
||
## Color | ||
|
||
### Default color | ||
|
||
| State | Element | Property | Color token | | ||
| ------- | ------- | ---------- | --------------------- | | ||
| Enabled | Text | text color | `$text-primary` | | ||
| | Button | border | `$border-inverse` | | ||
| | | background | `transparent` | | ||
| Hover | Text | text color | `$text-inverse` | | ||
| | Button | border | `$border-inverse` | | ||
| | | background | `$background-inverse` | | ||
| Focus | Button | border | `$focus` | | ||
|
||
<Row> | ||
<Column colLg={8}> | ||
|
||
![Examples of default AI label states](images/style-ai-label-states-default.png) | ||
|
||
</Column> | ||
</Row> | ||
|
||
### Inline color | ||
|
||
| State | Element | Property | Color token | | ||
| ------- | ------- | ---------- | ----------------- | | ||
| Enabled | Text | text color | `$text-primary` | | ||
| | Dot | fill | `$icon-primary` | | ||
| | Button | background | `transparent` | | ||
| Hover | Text | text color | `$text-secondary` | | ||
| | Button | border | `$border-inverse` | | ||
| | | background | `transparent` | | ||
| Focus | Button | border | `$focus` | | ||
|
||
<Row> | ||
<Column colLg={8}> | ||
|
||
![Examples of inline AI label states](images/style-ai-label-states-inline.png) | ||
|
||
</Column> | ||
</Row> | ||
|
||
### Explainability popover color | ||
|
||
| Element | Property | Color token | | ||
| ------------------ | ---------------------- | ------------------------ | | ||
| Popover background | background | `$ai-popover-background` | | ||
| | linear-gradient: start | `$ai-aura-start` | | ||
| | linear-gradient: end | `$ai-aura-end` | | ||
| Popover border | linear-gradient: start | `$ai-border-start` | | ||
| | linear-gradient: end | `$ai-border-end` | | ||
|
||
<Row> | ||
<Column colLg={8}> | ||
|
||
![Examples of an explainability popover](images/style-ai-label-explainability.png) | ||
|
||
</Column> | ||
</Row> | ||
|
||
## Typography | ||
|
||
### Default type | ||
|
||
| Element | Font-size (px/rem) | Font-weight | Type token | | ||
| ------------- | ------------------ | -------------- | ------------- | | ||
| Text (xl) | 20 / 1.25 | SemiBold / 600 | `$heading-03` | | ||
| Text (sm–lg) | 16 / 1 | SemiBold / 600 | `$heading-02` | | ||
| Text (2xs–xs) | 12 / 0.75 | SemiBold / 600 | – | | ||
| Text (mini) | 9 / 0.5625 | SemiBold / 600 | – | | ||
|
||
### Inline type | ||
|
||
| Element | Font-size (px/rem) | Font-weight | Type token | | ||
| --------- | ------------------ | -------------- | ------------- | | ||
| Text (lg) | 16 / 1 | SemiBold / 600 | `$heading-02` | | ||
| Text (md) | 14 / 0.875 | SemiBold / 600 | `$heading-01` | | ||
| Text (sm) | 12 / 0.75 | SemiBold / 600 | – | | ||
|
||
### Explainability popover type | ||
|
||
| Element | Font-size (px/rem) | Font-weight | Type token | | ||
| ------- | ------------------ | ------------- | ------------- | | ||
| Text | 14 / 0.875 | Regular / 400 | `$label-02` | | ||
| Title | 28 / 1.75 | Regular / 400 | `$heading-04` | | ||
| Body | 14 / 0.875 | Regular / 400 | `$body-01` | | ||
|
||
## Structure | ||
|
||
### Default structure | ||
|
||
| Element | Property | Value | Spacing token | | ||
| ------- | -------- | ----------------------------------------------------- | ------------- | | ||
| Button | border | 1px | – | | ||
| | height | See [sizes](/components/ai-label/style#default-sizes) | – | | ||
| Text | padding | centered | – | | ||
|
||
<div className="image--fixed"> | ||
|
||
![Structure of default AI labels](images/style-ai-label-structure-default.png) | ||
|
||
</div> | ||
|
||
<Caption> | ||
Recommended structure and spacing measurements for default AI label | px / rem | ||
</Caption> | ||
|
||
### Inline structure | ||
|
||
| Element | Property | px/rem | Spacing token | | ||
| -------------- | --------------------------- | ---------------------------------------------------- | ------------- | | ||
| Text | padding-left | 4px | `$spacing-02` | | ||
| Button | border | 1px | – | | ||
| | padding-left, padding-right | 4px | `$spacing-02` | | ||
| | height | See [sizes](/components/ai-label/style#inline-sizes) | – | | ||
| Bullet (sm-md) | height, width | 4px | – | | ||
| Bullet (lg) | height, width | 8px | – | | ||
|
||
<div className="image--fixed"> | ||
|
||
![Structure of inline AI labels](images/style-ai-label-structure-inline.png) | ||
|
||
</div> | ||
|
||
<Caption> | ||
Recommended structure and spacing measurements for inline AI label | px / rem | ||
</Caption> | ||
|
||
### Explainability popover structure | ||
|
||
| Element | Property | px/rem | Spacing token | | ||
| --------- | -------- | ------ | ------------- | | ||
| Container | padding | 24px | `$spacing-06` | | ||
| Footer | height | 48px | – | | ||
|
||
<div className="image--fixed"> | ||
|
||
![Structure of the explainability popover](images/style-ai-label-explainability-structure.png) | ||
|
||
</div> | ||
|
||
<Caption> | ||
Recommended structure and spacing measurements for the explainability popover | ||
| px / rem | ||
</Caption> | ||
|
||
## Sizes | ||
|
||
### Default sizes | ||
|
||
| Default size | Height (px/rem) | | ||
| ---------------- | --------------- | | ||
| Mini | 16 / 1 | | ||
| 2x small (2xs) | 20 / 1.25 | | ||
| Extra small (xs) | 24 / 1.5 | | ||
| Small (sm) | 32 / 2 | | ||
| Medium (md) | 40 / 2.5 | | ||
| Large (lg) | 48 / 3 | | ||
| Extra large (xl) | 64 / 4 | | ||
|
||
### Inline sizes | ||
|
||
| Inline size | Height (px/rem) | | ||
| ----------- | --------------- | | ||
| Small (sm) | 16 / 1 | | ||
| Medium (md) | 18 / 1.125 | | ||
| Large (lg) | 22 / 1.375 | |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one note. We will have to revisit the resource cards once the name chages in storybook to ai-label