Skip to content

Commit

Permalink
docs(Slug): move slug examples under experimental section (#15294)
Browse files Browse the repository at this point in the history
* docs(Slug): move slug examples under experimental section

* refactor(Slug): move all slug examples under slug

* test(e2e): update form test to match new location

* refactor(Slug): add controls to slug example components

* docs(Slug): add slug to controls table

* style(TextArea): fix label width issue
  • Loading branch information
tw15egan committed Dec 5, 2023
1 parent b0c87fa commit 5067a9b
Show file tree
Hide file tree
Showing 27 changed files with 1,219 additions and 937 deletions.
2 changes: 1 addition & 1 deletion e2e/components/Slug/Slug-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.describe('Slug @avt', () => {
test('@avt-advanced-states ai form', async ({ page }) => {
await visitStory(page, {
component: 'Slug',
id: 'components-form--ai-form',
id: 'experimental-unstable-slug-form--form-example',
globals: {
theme: 'white',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/components/Slug/Slug-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe('Slug', () => {
test('slug inside form @vrt', async ({ page }) => {
await snapshotStory(page, {
component: 'Slug',
id: 'components-form--ai-form',
id: 'experimental-unstable-slug-form--form-example',
theme,
});
});
Expand Down
3 changes: 3 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,9 @@ Map {
"onKeyUp": Object {
"type": "func",
},
"slug": Object {
"type": "node",
},
"tabIndex": Object {
"type": "number",
},
Expand Down
83 changes: 0 additions & 83 deletions packages/react/src/components/Checkbox/Checkbox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import React from 'react';
import { default as Checkbox, CheckboxSkeleton } from './';
import mdx from './Checkbox.mdx';
import CheckboxGroup from '../CheckboxGroup';
import { View, FolderOpen, Folders } from '@carbon/icons-react';
import { Slug, SlugContent, SlugActions } from '../Slug';
import { IconButton } from '../IconButton';
import { Button } from '../Button';

const checkboxEvents = {
className: 'some-class',
Expand Down Expand Up @@ -75,80 +71,6 @@ export const Single = () => {
);
};

export const SlugTest = () => {
const slug = (kind) => (
<Slug kind={kind} className="slug-container">
<SlugContent>
<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>
<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 literature</Button>
</SlugActions>
</SlugContent>
</Slug>
);

return (
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
<CheckboxGroup
legendText="Group Label"
slug={slug()}
style={{ flex: '1 1 auto' }}>
<Checkbox labelText={`Checkbox label`} id="checkbox-label-1" />
<Checkbox labelText={`Checkbox label`} id="checkbox-label-2" />
<Checkbox labelText={`Checkbox label`} id="checkbox-label-3" />
</CheckboxGroup>

<CheckboxGroup legendText="Group Label" style={{ flex: '1 1 auto' }}>
<Checkbox
labelText={`Checkbox label`}
id="checkbox-label-4"
slug={slug()}
/>
<Checkbox
labelText={`Checkbox label`}
id="checkbox-label-5"
slug={slug()}
/>
<Checkbox labelText={`Checkbox label`} id="checkbox-label-6" />
</CheckboxGroup>

<CheckboxGroup legendText="Group Label" style={{ flex: '1 1 auto' }}>
<Checkbox
labelText={`Checkbox label`}
id="checkbox-label-7"
slug={slug('inline')}
/>
<Checkbox
labelText={`Checkbox label`}
id="checkbox-label-8"
slug={slug('inline')}
/>
<Checkbox labelText={`Checkbox label`} id="checkbox-label-9" />
</CheckboxGroup>
</div>
);
};

export const Skeleton = () => <CheckboxSkeleton />;

export const Playground = (args) => (
Expand Down Expand Up @@ -234,11 +156,6 @@ Playground.argTypes = {
disable: true,
},
},
disabled: {
table: {
disable: true,
},
},
hideLabel: {
table: {
disable: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface CheckboxProps
invalidText?: React.ReactNode;

/**
* Provide a `Slug` component to be rendered inside the `Checkbox` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
*/
slug?: ReactNodeLike;

Expand Down Expand Up @@ -300,7 +300,7 @@ Checkbox.propTypes = {
readOnly: PropTypes.bool,

/**
* Provide a `Slug` component to be rendered inside the `Checkbox` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
*/
slug: PropTypes.node,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ CheckboxGroup.propTypes = {
readOnly: PropTypes.bool,

/**
* Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
*/
slug: PropTypes.node,

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export interface ComboBoxProps<ItemType>
size?: ListBoxSize;

/**
* Provide a `Slug` component to be rendered inside the `ComboBox` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
*/
slug?: ReactNodeLike;

Expand Down Expand Up @@ -957,7 +957,7 @@ ComboBox.propTypes = {
size: ListBoxPropTypes.ListBoxSize,

/**
* Provide a `Slug` component to be rendered inside the `ComboBox` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
*/
slug: PropTypes.node,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ interface DatePickerInputProps
size?: 'sm' | 'md' | 'lg';

/**
* Provide a `Slug` component to be rendered inside the `DatePickerInput` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
*/
slug?: ReactNodeLike;

Expand Down Expand Up @@ -360,7 +360,7 @@ DatePickerInput.propTypes = {
size: PropTypes.oneOf(['sm', 'md', 'lg']),

/**
* Provide a `Slug` component to be rendered inside the `DatePickerInput` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
*/
slug: PropTypes.node,

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export interface DropdownProps<ItemType>
size?: ListBoxSize;

/**
* Provide a `Slug` component to be rendered inside the `Dropdown` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
*/
slug?: ReactNodeLike;

Expand Down Expand Up @@ -708,7 +708,7 @@ Dropdown.propTypes = {
size: ListBoxPropTypes.ListBoxSize,

/**
* Provide a `Slug` component to be rendered inside the `Dropdown` component
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
*/
slug: PropTypes.node,

Expand Down
Loading

0 comments on commit 5067a9b

Please sign in to comment.