Skip to content

Commit

Permalink
chore(AI Label): web components - rename Slug to AI Label (#17739)
Browse files Browse the repository at this point in the history
* chore: rename ai slug to ai label

* chore: rename to ai-label

* chore: rename slug example to ai-label

* chore: add ai label to form group stories

* chore: rename handle slug slot change methods

* chore: all stories shifted

* fix: fix radio-button with ai-label

* fix: modal ai-label styles

* chore: rename test files to ai-label

* chore: add space between AI and Label in docs

* chore: undo changes to tearsheet and side-panel

* chore: keep slug component as deprecated

* chore: restore readme

* fix: specify js extensions for icon imports (#17818)

* chore: add extensions to icons in stories

* fix: show actions for playground and datatable sort

* fix: catch both slug and ai-label in event handlers
  • Loading branch information
annawen1 authored Oct 22, 2024
1 parent f0225b5 commit b543079
Show file tree
Hide file tree
Showing 94 changed files with 3,055 additions and 1,773 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/web-components/examples/autoalign/cdn.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
></script>
<script
type="module"
src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/slug.min.js"
src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/ai-label.min.js"
></script>
<script
type="module"
Expand Down Expand Up @@ -127,7 +127,7 @@
</div>

<div class="section">
<cds-slug autoalign>
<cds-ai-label autoalign>
<div slot="body-text">
<p class="secondary">AI Explained</p>
<h1>84%</h1>
Expand All @@ -140,7 +140,7 @@ <h1>84%</h1>
<p class="secondary">Model type</p>
<p class="bold">Foundation model</p>
</div>
</cds-slug>
</cds-ai-label>
</div>

<script>
Expand Down
6 changes: 3 additions & 3 deletions packages/web-components/examples/autoalign/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
cds-tooltip:not(:defined) {
display: none;
}
cds-slug:not(:defined) {
cds-ai-label:not(:defined) {
display: none;
}
</style>
Expand Down Expand Up @@ -111,7 +111,7 @@
</div>

<div class="section">
<cds-slug autoalign>
<cds-ai-label autoalign>
<div slot="body-text">
<p class="secondary">AI Explained</p>
<h1>84%</h1>
Expand All @@ -124,7 +124,7 @@ <h1>84%</h1>
<p class="secondary">Model type</p>
<p class="bold">Foundation model</p>
</div>
</cds-slug>
</cds-ai-label>
</div>

<script>
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/examples/autoalign/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* LICENSE file in the root directory of this source tree.
*/

import "@carbon/web-components/es/components/slug/index.js";
import "@carbon/web-components/es/components/ai-label/index.js";
import "@carbon/web-components/es/components/popover/index.js";
import "@carbon/web-components/es/components/toggle-tip/index.js";
import "@carbon/web-components/es/components/tooltip/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-slug:not(:defined) {
cds-ai-label:not(:defined) {
display: none;
}
</style>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/slug/v2/latest/slug.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/ai-label.min.js"></script>
</head>
<body class="cds-theme-zone-white">
<cds-slug size="mini" alignment="bottom-left">
<cds-ai-label size="mini" alignment="bottom-left">
<span slot="body-text">AI was used to generate this content</span>
</cds-slug>
</cds-ai-label>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<link rel="stylesheet" href="src/styles.scss" />
<style>
/* Suppress custom element until styles are loaded */
cds-slug:not(:defined) {
cds-ai-label:not(:defined) {
display: none;
}
</style>
<script type="module" src="src/index.js"></script>
</head>
<body>
<cds-slug size="mini" alignment="bottom-left">
<cds-ai-label size="mini" alignment="bottom-left">
<span slot="body-text">AI was used to generate this content</span>
</cds-slug>
</cds-ai-label>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "carbon-web-components-slug-example",
"name": "carbon-web-components-ai-label-example",
"version": "0.1.0",
"private": true,
"description": "Sample project for getting started with the Web Components from Carbon.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* LICENSE file in the root directory of this source tree.
*/

import '@carbon/web-components/es/components/slug/index.js';
import '@carbon/web-components/es/components/ai-label/index.js';
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/button.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/text-input.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/textarea.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/slug.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/ai-label.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/tabs.min.js"></script>
</head>
<body class="cds-theme-zone-white">
Expand Down Expand Up @@ -99,8 +99,8 @@ <h5>Section</h5>
Primary
</cds-button>

<!-- slotted slug -->
<cds-slug size="xs" alignment="bottom-right">
<!-- slotted ai-label -->
<cds-ai-label size="xs" alignment="bottom-right">
<div slot="body-text">
<p class="secondary">AI Explained</p>
<h1>84%</h1>
Expand All @@ -113,7 +113,7 @@ <h1>84%</h1>
<p class="secondary">Model type</p>
<p class="bold">Foundation model</p>
</div>
</cds-slug>
</cds-ai-label>
</cds-side-panel>
</body>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ <h5>Section</h5>
Primary
</cds-button>

<!-- slotted slug -->
<cds-slug size="xs" alignment="bottom-right">
<!-- slotted ai-label -->
<cds-ai-label size="xs" alignment="bottom-right">
<div slot="body-text">
<p class="secondary">AI Explained</p>
<h1>84%</h1>
Expand All @@ -107,7 +107,7 @@ <h1>84%</h1>
<p class="secondary">Model type</p>
<p class="bold">Foundation model</p>
</div>
</cds-slug>
</cds-ai-label>
</cds-side-panel>
</body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import '@carbon/web-components/es/components/side-panel/index.js';
import '@carbon/web-components/es/components/button/index.js';
import '@carbon/web-components/es/components/text-input/index.js';
import '@carbon/web-components/es/components/textarea/index.js';
import '@carbon/web-components/es/components/slug/index.js';
import '@carbon/web-components/es/components/ai-label/index.js';
import '@carbon/web-components/es/components/tabs/index.js';
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
></script>
<script
type="module"
src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/slug.min.js"
src="https://1.www.s81c.com/common/carbon/web-components/tag/latest/ai-label.min.js"
></script>
<script
type="module"
Expand Down Expand Up @@ -122,8 +122,8 @@ <h5>Section</h5>
Primary
</cds-button>

<!-- slotted slug -->
<cds-slug size="xs" alignment="bottom-right">
<!-- slotted ai-label -->
<cds-ai-label size="xs" alignment="bottom-right">
<div slot="body-text">
<p class="secondary">AI Explained</p>
<h1>84%</h1>
Expand All @@ -136,7 +136,7 @@ <h1>84%</h1>
<p class="secondary">Model type</p>
<p class="bold">Foundation model</p>
</div>
</cds-slug>
</cds-ai-label>

<!-- slotted header-navigation -->
<div slot="header-navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ <h5>Section</h5>
Primary
</cds-button>

<!-- slotted slug -->
<cds-slug size="xs" alignment="bottom-right">
<!-- slotted ai-label -->
<cds-ai-label size="xs" alignment="bottom-right">
<div slot="body-text">
<p class="secondary">AI Explained</p>
<h1>84%</h1>
Expand All @@ -107,7 +107,7 @@ <h1>84%</h1>
<p class="secondary">Model type</p>
<p class="bold">Foundation model</p>
</div>
</cds-slug>
</cds-ai-label>

<!-- slotted header-navigation -->
<div slot="header-navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import '@carbon/web-components/es/components/tearsheet/index.js';
import '@carbon/web-components/es/components/button/index.js';
import '@carbon/web-components/es/components/text-input/index.js';
import '@carbon/web-components/es/components/textarea/index.js';
import '@carbon/web-components/es/components/slug/index.js';
import '@carbon/web-components/es/components/ai-label/index.js';
import '@carbon/web-components/es/components/tabs/index.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { property } from 'lit/decorators.js';
import { prefix } from '../../globals/settings';
import CDSButton from '../button/button';
import styles from './ai-label.scss?lit';
import { carbonElement as customElement } from '../../globals/decorators/carbon-element';

/**
* AI Label action button.
*
* @element cds-ai-label-action-button
*/
@customElement(`${prefix}-ai-label-action-button`)
export default class CDSAILabelActionButton extends CDSButton {
/**
* The shadow slot this ai-label-action should be in.
*/
@property({ reflect: true })
slot = 'actions';

static styles = styles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@use '@carbon/styles/scss/type' as *;
@use '@carbon/styles/scss/config' as *;

.slug-container {
.ai-label-container {
display: flex;
align-items: flex-start;
margin-block-end: $spacing-12;
Expand All @@ -22,7 +22,7 @@
}
}

.slug-container-example.centered {
.ai-label-container-example.centered {
align-items: center;
justify-content: center;
margin: 0;
Expand Down Expand Up @@ -56,7 +56,7 @@ div #{$prefix}-selectable-tile::-moz-list-bullet {
margin-block-end: $spacing-05;
}

.slug-tile-container {
.ai-label-tile-container {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
Expand All @@ -78,37 +78,37 @@ div #{$prefix}-selectable-tile::-moz-list-bullet {
}
}

.slug-tile-container h4 {
.ai-label-tile-container h4 {
margin-block-end: $spacing-05;
}

.slug-tile-container .ai-data {
.ai-label-tile-container .ai-data {
display: flex;
padding: $spacing-05 0;
margin-block-start: $spacing-05;
}

.slug-tile-container .data-container {
.ai-label-tile-container .data-container {
inline-size: 126px;
}

.slug-tile-container .data-container:first-of-type {
.ai-label-tile-container .data-container:first-of-type {
margin-inline-end: $spacing-05;
}

.slug-tile-container p {
.ai-label-tile-container p {
@include type-style('body-01');
}

.slug-tile-container .data-container p {
.ai-label-tile-container .data-container p {
@include type-style('label-02');
}

.slug-tile-container #{$prefix}-tile-below-the-fold-content {
.ai-label-tile-container #{$prefix}-tile-below-the-fold-content {
padding-block-start: $spacing-05;
}

.slug-tile-container #{$prefix}-tile-below-the-fold-content p {
.ai-label-tile-container #{$prefix}-tile-below-the-fold-content p {
@include type-style('label-01');

margin: $spacing-03 0 50px;
Expand Down
Loading

0 comments on commit b543079

Please sign in to comment.