Skip to content

Commit

Permalink
Merge branch 'main' into 15970-fix-datatable-toolbar-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andreancardona authored Mar 18, 2024
2 parents a43b652 + 7f81f71 commit adeff01
Show file tree
Hide file tree
Showing 26 changed files with 177 additions and 450 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Array [
"aiAuraHoverEnd",
"aiAuraHoverStart",
"aiAuraStart",
"aiAuraStartTable",
"aiAuraStartSm",
"aiBorderEnd",
"aiBorderStart",
"aiBorderStrong",
"aiDropShadow",
"aiInnerShadow",
"aiOverlay",
"aiPopoverBackground",
"aiPopoverCaretBottom",
"aiPopoverCaretBottomBackground",
"aiPopoverCaretBottomBackgroundActions",
Expand Down Expand Up @@ -308,11 +309,6 @@ Array [
"skeletonElement",
"slow01",
"slow02",
"slugBackground",
"slugBackgroundHover",
"slugGradient",
"slugGradientHover",
"slugHollowHover",
"spacing",
"spacing01",
"spacing02",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ async function writeIndex(buckets, outDir) {
templates.banner +
'\n' +
"export { default as Icon } from './Icon';\n" +
"export { CarbonIconProps, CarbonIconType } from './CarbonIcon';\n" +
bucketModules.map((path) => "export * from './" + path + "';").join('\n') +
'\n';
await fs.writeFile(path.resolve(outDir, 'index.d.ts'), indexContent);
Expand Down
10 changes: 0 additions & 10 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10468,20 +10468,10 @@ Map {
"className": Object {
"type": "string",
},
"dotType": Object {
"args": Array [
Array [
"default",
"hollow",
],
],
"type": "oneOf",
},
"kind": Object {
"args": Array [
Array [
"default",
"hollow",
"inline",
],
],
Expand Down
Binary file modified packages/react/examples/react-router/.yarn/install-state.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/react/examples/react-router/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7491,12 +7491,12 @@ __metadata:
linkType: hard

"follow-redirects@npm:^1.0.0":
version: 1.15.4
resolution: "follow-redirects@npm:1.15.4"
version: 1.15.6
resolution: "follow-redirects@npm:1.15.6"
peerDependenciesMeta:
debug:
optional: true
checksum: 10/2e8f5f259a6b02dfa8dc199e08431848a7c3beed32eb4c19945966164a52c89f07b86c3afcc32ebe4279cf0a960520e45a63013d6350309c5ec90133c5d9351a
checksum: 10/70c7612c4cab18e546e36b991bbf8009a1a41cf85354afe04b113d1117569abf760269409cb3eb842d9f7b03d62826687086b081c566ea7b1e6613cf29030bf7
languageName: node
linkType: hard

Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@ibm/telemetry-js": "^1.2.1",
"classnames": "2.5.1",
"copy-to-clipboard": "^3.3.1",
"downshift": "8.4.0",
"downshift": "8.5.0",
"flatpickr": "4.6.13",
"invariant": "^2.2.3",
"lodash.debounce": "^4.0.8",
Expand Down
48 changes: 3 additions & 45 deletions packages/react/src/components/Slug/Slug.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import * as SlugStories from './Slug.stories';
- [Component API](#component-api)
- [Slug `aiText`](#slug-aitext)
- [Slug `aiTextLabel`](#slug-aitextlabel)
- [Slug `dotType`](#slug-dottype)
- [Slug `kind`](#slug-kind)
- [Slug `revertActive` and `onRevertClick`](#slug-revertactive-and-onrevertclick)
- [Feedback](#feedback)
Expand Down Expand Up @@ -114,57 +113,16 @@ the `aiTextLabel` prop.
</Slug>
```

### Slug `dotType`

When using the `inline` variant, you can switch between the `hollow` slug for
content that does not need additional explainability or the `default` variant
that will render the AI callout.

<Slug
kind="inline"
dotType="default"
aiTextLabel="Text goes here"
className="sbdocs-slug">
<SlugContent>Explanation of AI generated content</SlugContent>
</Slug>
<br />
<Slug
kind="inline"
dotType="hollow"
aiTextLabel="Text goes here"
className="sbdocs-slug">
<SlugContent>Explanation of AI generated content</SlugContent>
</Slug>

```jsx
<Slug
kind="inline"
dotType="default"
aiTextLabel="Text goes here">
<SlugContent>Explanation of AI generated content</SlugContent>
</Slug>

<Slug
kind="inline"
dotType="hollow"
aiTextLabel="Text goes here">
<SlugContent>Explanation of AI generated content</SlugContent>
</Slug>
```

### Slug `kind`

The `Slug` component has three variants, `default`, `hollow`, and `inline`. The
`hollow` slugs represent items that don’t have any additional explainability.
Therefore they don’t use the AI callout and instead use the standard Carbon
tooltip, with a simple message.
The `Slug` component has two variants, `default` and `inline`.

<Slug kind="hollow" size="xs" className="sbdocs-slug">
<Slug size="xs" className="sbdocs-slug">
<SlugContent>AI was used to generate this content</SlugContent>
</Slug>

```jsx
<Slug kind="hollow" size="xs">
<Slug size="xs">
<SlugContent>AI was used to generate this content</SlugContent>
</Slug>
```
Expand Down
122 changes: 31 additions & 91 deletions packages/react/src/components/Slug/Slug.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const aiContent = (
</div>
);

const content = <span>AI was used to generate this content</span>;

export const Default = () => (
<>
<div className="slug-container slug-container-example">
Expand Down Expand Up @@ -138,17 +136,6 @@ export const Default = () => (
</SlugContent>
</Slug>
</div>
<div className="slug-container-example slug-container">
<Slug kind="hollow" autoAlign size="mini">
<SlugContent>{content}</SlugContent>
</Slug>
<Slug kind="hollow" autoAlign size="2xs">
<SlugContent>{content}</SlugContent>
</Slug>
<Slug kind="hollow" autoAlign size="xs">
<SlugContent>{content}</SlugContent>
</Slug>
</div>
<div className="slug-container-example slug-container">
<Slug autoAlign kind="inline" size="sm">
<SlugContent>
Expand Down Expand Up @@ -255,43 +242,6 @@ export const Default = () => (
</SlugContent>
</Slug>
</div>
<div className="slug-container-example slug-container">
<Slug autoAlign kind="inline" dotType="hollow" size="sm">
<SlugContent>{content}</SlugContent>
</Slug>
<Slug autoAlign kind="inline" dotType="hollow" size="md">
<SlugContent>{content}</SlugContent>
</Slug>
<Slug autoAlign kind="inline" dotType="hollow" size="lg">
<SlugContent>{content}</SlugContent>
</Slug>
</div>
<div className="slug-container-example slug-container">
<Slug
autoAlign
kind="inline"
dotType="hollow"
size="sm"
aiTextLabel="Text goes here">
<SlugContent>{content}</SlugContent>
</Slug>
<Slug
autoAlign
kind="inline"
dotType="hollow"
size="md"
aiTextLabel="Text goes here">
<SlugContent>{content}</SlugContent>
</Slug>
<Slug
autoAlign
kind="inline"
dotType="hollow"
size="lg"
aiTextLabel="Text goes here">
<SlugContent>{content}</SlugContent>
</Slug>
</div>
</>
);

Expand Down Expand Up @@ -373,11 +323,6 @@ Callout.argTypes = {
disable: true,
},
},
dotType: {
table: {
disable: true,
},
},
kind: {
table: {
disable: true,
Expand Down Expand Up @@ -411,43 +356,38 @@ Callout.argTypes = {
};

export const Playground = (args) => {
const { kind, dotType, showSlugActions = true } = args;
const { showSlugActions = true } = args;

let renderedContent;
if (kind === 'hollow' || dotType === 'hollow') {
renderedContent = content;
} else {
renderedContent = (
<>
<div>
<p className="secondary">AI Explained</p>
<h1>84%</h1>
<p className="secondary bold">Confidence score</p>
<p className="secondary">
Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut fsil labore et dolore magna aliqua.
</p>
<hr />
<p className="secondary">Model type</p>
<p className="bold">Foundation model</p>
</div>
{showSlugActions && (
<SlugActions>
<IconButton kind="ghost" label="View">
<View />
</IconButton>
<IconButton kind="ghost" label="Open Folder">
<FolderOpen />
</IconButton>
<IconButton kind="ghost" label="Folders">
<Folders />
</IconButton>
<Button>View details</Button>
</SlugActions>
)}
</>
);
}
const renderedContent = (
<>
<div>
<p className="secondary">AI Explained</p>
<h1>84%</h1>
<p className="secondary bold">Confidence score</p>
<p className="secondary">
Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut fsil labore et dolore magna aliqua.
</p>
<hr />
<p className="secondary">Model type</p>
<p className="bold">Foundation model</p>
</div>
{showSlugActions && (
<SlugActions>
<IconButton kind="ghost" label="View">
<View />
</IconButton>
<IconButton kind="ghost" label="Open Folder">
<FolderOpen />
</IconButton>
<IconButton kind="ghost" label="Folders">
<Folders />
</IconButton>
<Button>View details</Button>
</SlugActions>
)}
</>
);

return (
<>
Expand Down
6 changes: 0 additions & 6 deletions packages/react/src/components/Slug/__tests__/Slug-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ describe('Slug', () => {
);
});

it('should respect dotType prop', () => {
const { container } = render(<Slug kind="inline" dotType="hollow" />);

expect(container.firstChild).toHaveClass(`${prefix}--slug--hollow`);
});

it('should respect kind prop', () => {
render(<Slug kind="inline" />);

Expand Down
13 changes: 1 addition & 12 deletions packages/react/src/components/Slug/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export const Slug = React.forwardRef(function Slug(
autoAlign = true,
children,
className,
dotType,
kind = 'default',
onRevertClick,
revertActive,
Expand All @@ -110,11 +109,6 @@ export const Slug = React.forwardRef(function Slug(

const slugClasses = cx(className, {
[`${prefix}--slug`]: true,
[`${prefix}--slug--hollow`]: kind === 'hollow' || dotType === 'hollow',
// Need to come up with a better name; explainable?
// Need to be able to target the non-hollow variant another way
// other than using `:not` all over the styles
[`${prefix}--slug--enabled`]: kind !== 'hollow' && dotType !== 'hollow',
[`${prefix}--slug--revert`]: revertActive,
});

Expand Down Expand Up @@ -212,15 +206,10 @@ Slug.propTypes = {
*/
className: PropTypes.string,

/**
* Specify the type of dot that should be rendered in front of the inline variant
*/
dotType: PropTypes.oneOf(['default', 'hollow']),

/**
* Specify the type of Slug, from the following list of types:
*/
kind: PropTypes.oneOf(['default', 'hollow', 'inline']),
kind: PropTypes.oneOf(['default', 'inline']),

/**
* Callback function that fires when the revert button is clicked
Expand Down
8 changes: 2 additions & 6 deletions packages/styles/scss/__tests__/theme-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,12 @@ describe('@carbon/styles/scss/theme', () => {
"support-caution-major",
"support-caution-minor",
"support-caution-undefined",
"slug-background",
"slug-gradient",
"slug-background-hover",
"slug-gradient-hover",
"slug-hollow-hover",
"ai-popover-background",
"ai-popover-shadow-outer-01",
"ai-popover-shadow-outer-02",
"ai-inner-shadow",
"ai-aura-start-sm",
"ai-aura-start",
"ai-aura-start-table",
"ai-aura-end",
"ai-aura-hover-background",
"ai-aura-hover-start",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@
// Same gradient as background
border-block-start: linear-gradient(
to right,
$ai-aura-start-table 0%,
$ai-aura-start-sm 0%,
$ai-aura-end 50%,
transparent 50%
);
Expand Down
Loading

0 comments on commit adeff01

Please sign in to comment.