{
+ const items = [
+ {
+ id: 'downshift-1-item-0',
+ text: 'Option 1',
+ },
+ {
+ id: 'downshift-1-item-1',
+ text: 'Option 2',
+ },
+ {
+ id: 'downshift-1-item-2',
+ text: 'Option 3 - a disabled item',
+ disabled: true,
+ },
+ {
+ id: 'downshift-1-item-3',
+ text: 'Option 4',
+ },
+ {
+ id: 'downshift-1-item-4',
+ text: 'An example option that is really long to show what should be done to handle long text',
+ },
+ {
+ id: 'downshift-1-item-5',
+ text: 'Option 5',
+ },
+ ];
return (
{
};
export const Filterable = (args) => {
+ const items = [
+ {
+ id: 'downshift-1-item-0',
+ text: 'Option 1',
+ },
+ {
+ id: 'downshift-1-item-1',
+ text: 'Option 2',
+ },
+ {
+ id: 'downshift-1-item-2',
+ text: 'Option 3 - a disabled item',
+ disabled: true,
+ },
+ {
+ id: 'downshift-1-item-3',
+ text: 'Option 4',
+ },
+ {
+ id: 'downshift-1-item-4',
+ text: 'An example option that is really long to show what should be done to handle long text',
+ },
+ {
+ id: 'downshift-1-item-5',
+ text: 'Option 5',
+ },
+ ];
return (
@@ -20,11 +21,27 @@ import * as NumberInputStories from './NumberInput.stories';
## Overview
-
+
stackblitzPrefillConfig(NumberInputStories.Default),
+ },
+ ]}
+/>
## Skeleton State
-
+ stackblitzPrefillConfig(NumberInputStories.Skeleton),
+ },
+ ]}
+/>
## Component API
diff --git a/packages/react/src/components/NumberInput/NumberInput.stories.js b/packages/react/src/components/NumberInput/NumberInput.stories.js
index 0b2b754174bb..a22bd626a4e2 100644
--- a/packages/react/src/components/NumberInput/NumberInput.stories.js
+++ b/packages/react/src/components/NumberInput/NumberInput.stories.js
@@ -12,6 +12,7 @@ import Button from '../Button';
import { AILabel, AILabelContent, AILabelActions } from '../AILabel';
import { IconButton } from '../IconButton';
import { View, FolderOpen, Folders } from '@carbon/icons-react';
+import mdx from './NumberInput.mdx';
export default {
title: 'Components/NumberInput',
@@ -20,6 +21,9 @@ export default {
subcomponents: {
NumberInputSkeleton,
},
+ docs: {
+ page: mdx,
+ },
},
};
@@ -70,7 +74,7 @@ const sharedArgTypes = {
},
};
-export const Default = ({ ...args }) => {
+export const Default = (args) => {
const [value, setValue] = React.useState(50);
const handleChange = (event, { value }) => {
@@ -153,4 +157,6 @@ export const withAILabel = (args) => (
withAILabel.argTypes = { ...sharedArgTypes };
-export const Skeleton = () => ;
+export const Skeleton = () => {
+ return ;
+};
diff --git a/packages/react/src/components/OrderedList/OrderedList.mdx b/packages/react/src/components/OrderedList/OrderedList.mdx
index 3e1d81e8a417..f6cea02376d1 100644
--- a/packages/react/src/components/OrderedList/OrderedList.mdx
+++ b/packages/react/src/components/OrderedList/OrderedList.mdx
@@ -1,5 +1,6 @@
import { ArgTypes, Canvas, Story, Meta } from '@storybook/blocks';
import * as OrderedListStories from './OrderedList.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -16,7 +17,15 @@ import * as OrderedListStories from './OrderedList.stories';
## Overview
-
+ stackblitzPrefillConfig(OrderedListStories.Default),
+ },
+ ]}
+ />
## Component API
diff --git a/packages/react/src/components/OverflowMenu/OverflowMenu.mdx b/packages/react/src/components/OverflowMenu/OverflowMenu.mdx
index f50033faf05a..fe066e9747ad 100644
--- a/packages/react/src/components/OverflowMenu/OverflowMenu.mdx
+++ b/packages/react/src/components/OverflowMenu/OverflowMenu.mdx
@@ -1,5 +1,6 @@
import { Story, ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as OverflowMenuStories from './OverflowMenu.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -18,7 +19,15 @@ import * as OverflowMenuStories from './OverflowMenu.stories';
The overflow menu component is a clickable element that contains additional
options that are available to the user, but there is a space constraint.
-
+ stackblitzPrefillConfig(OverflowMenuStories.Default),
+ },
+ ]}
+/>
### `data-floating-menu-container`
@@ -29,7 +38,16 @@ this attribute is found, the menu will be placed on `document.body`.
## Render Custom Icon
-
+
+ stackblitzPrefillConfig(OverflowMenuStories.RenderCustomIcon),
+ },
+ ]}
+/>
## Customizing the tooltip
diff --git a/packages/react/src/components/OverflowMenu/OverflowMenu.stories.js b/packages/react/src/components/OverflowMenu/OverflowMenu.stories.js
index ab0066baee09..400be28eb2c8 100644
--- a/packages/react/src/components/OverflowMenu/OverflowMenu.stories.js
+++ b/packages/react/src/components/OverflowMenu/OverflowMenu.stories.js
@@ -24,12 +24,14 @@ export default {
},
};
-export const RenderCustomIcon = () => (
-
-
-
-
-);
+export const RenderCustomIcon = () => {
+ return (
+
+
+
+
+ );
+};
export const Default = (args) => (
diff --git a/packages/react/src/components/ProgressIndicator/ProgressIndicator.mdx b/packages/react/src/components/ProgressIndicator/ProgressIndicator.mdx
index ad330b0c6835..253b3a70e163 100644
--- a/packages/react/src/components/ProgressIndicator/ProgressIndicator.mdx
+++ b/packages/react/src/components/ProgressIndicator/ProgressIndicator.mdx
@@ -1,5 +1,6 @@
import { Story, Canvas, ArgTypes, Meta } from '@storybook/blocks';
import * as ProgressIndicatorStories from './ProgressIndicator.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -27,7 +28,15 @@ import * as ProgressIndicatorStories from './ProgressIndicator.stories';
## Overview
-
+ stackblitzPrefillConfig(ProgressIndicatorStories.Default),
+ },
+ ]}
+/>
For React usage, `ProgressIndicator` holds the `currentIndex` state to indicate
which `ProgressStep` is the current step. The `ProgressIndicator` component
diff --git a/packages/react/src/components/RadioButton/RadioButton.mdx b/packages/react/src/components/RadioButton/RadioButton.mdx
index c0cf94a1f072..e73c3c39c631 100644
--- a/packages/react/src/components/RadioButton/RadioButton.mdx
+++ b/packages/react/src/components/RadioButton/RadioButton.mdx
@@ -1,5 +1,6 @@
import { ArgTypes, Canvas, Story, Meta } from '@storybook/blocks';
import * as RadioButtonStories from './RadioButton.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -27,7 +28,15 @@ rendered individually, it is recommended they be rendered as children components
of the `RadioButtonGroup` parent component to maintain their proper controlled
states.
-
+ stackblitzPrefillConfig(RadioButtonStories.Default),
+ },
+ ]}
+/>
## Component API
diff --git a/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.mdx b/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.mdx
index cfe9482f4be2..893ec991067d 100644
--- a/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.mdx
+++ b/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.mdx
@@ -1,5 +1,6 @@
import { Story, ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as SkeletonPlaceholderStories from './SkeletonPlaceholder.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -13,7 +14,16 @@ import * as SkeletonPlaceholderStories from './SkeletonPlaceholder.stories';
## Overview
-
+
+ stackblitzPrefillConfig(SkeletonPlaceholderStories.Default),
+ },
+ ]}
+/>
## Component API
diff --git a/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.stories.js b/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.stories.js
index bb339081f0ed..8e9ccd8d9092 100644
--- a/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.stories.js
+++ b/packages/react/src/components/SkeletonPlaceholder/SkeletonPlaceholder.stories.js
@@ -22,4 +22,6 @@ export default {
},
};
-export const Default = () => ;
+export const Default = () => {
+ return ;
+};
diff --git a/packages/react/src/components/SkeletonText/SkeletonText.mdx b/packages/react/src/components/SkeletonText/SkeletonText.mdx
index de5a11378226..cbd29d5baf34 100644
--- a/packages/react/src/components/SkeletonText/SkeletonText.mdx
+++ b/packages/react/src/components/SkeletonText/SkeletonText.mdx
@@ -1,5 +1,6 @@
import { ArgTypes, Canvas, Story, Meta } from '@storybook/blocks';
import * as SkeletonTextStories from './SkeletonText.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -13,10 +14,20 @@ import * as SkeletonTextStories from './SkeletonText.stories';
## Overview
-
+ stackblitzPrefillConfig(SkeletonTextStories.Default),
+ },
+ ]}
+/>
## Component API
+w
+
## Feedback
diff --git a/packages/react/src/components/SkeletonText/SkeletonText.stories.js b/packages/react/src/components/SkeletonText/SkeletonText.stories.js
index 9657e35f5ee3..f0cd10e21905 100644
--- a/packages/react/src/components/SkeletonText/SkeletonText.stories.js
+++ b/packages/react/src/components/SkeletonText/SkeletonText.stories.js
@@ -22,7 +22,9 @@ export default {
},
};
-export const Default = (args) => ;
+export const Default = (args) => {
+ return ;
+};
Default.args = {
heading: false,
diff --git a/packages/react/src/components/Tabs/Tabs.mdx b/packages/react/src/components/Tabs/Tabs.mdx
index 53667c363672..280bb387dbcd 100644
--- a/packages/react/src/components/Tabs/Tabs.mdx
+++ b/packages/react/src/components/Tabs/Tabs.mdx
@@ -43,17 +43,49 @@ what is in rendered inside of `Tab` and `TabPanel`.
### Line Tabs
-
+ stackblitzPrefillConfig(TabsStories.Default),
+ },
+ ]}
+/>
### Contained Tabs
-
+ stackblitzPrefillConfig(TabsStories.Contained),
+ },
+ ]}
+/>
### Icon Tabs
-
-
-
+ stackblitzPrefillConfig(TabsStories.IconOnly),
+ },
+ ]}
+/>
+
+ stackblitzPrefillConfig(TabsStories.Icon20Only),
+ },
+ ]}
+/>
### Dismissable Tabs
@@ -175,11 +207,27 @@ return (
And there you have it! Working dismissable tabs.
-
+ stackblitzPrefillConfig(TabsStories.Dismissable),
+ },
+ ]}
+/>
### Vertical tabs
-
+ stackblitzPrefillConfig(TabsStories.Vertical),
+ },
+ ]}
+/>
## Component API
diff --git a/packages/react/src/components/Tabs/Tabs.stories.js b/packages/react/src/components/Tabs/Tabs.stories.js
index f296b10449cf..e82b20f29133 100644
--- a/packages/react/src/components/Tabs/Tabs.stories.js
+++ b/packages/react/src/components/Tabs/Tabs.stories.js
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
-import React, { useState } from 'react';
+import React from 'react';
import {
Tabs,
TabsVertical,
@@ -32,7 +32,7 @@ import {
Activity,
CloudMonitoring,
Settings,
- Search,
+ IbmWatsonDiscovery,
Notification,
Chat,
Task,
@@ -64,22 +64,24 @@ export default {
},
};
-export const Default = ({ dismissable, ...args }) => (
- {}}>
-
- Dashboard
- Monitoring
- Activity
- Settings
-
-
- Tab Panel 1
- Tab Panel 2
- Tab Panel 3
- Tab Panel 4
-
-
-);
+export const Default = (args) => {
+ return (
+ {}}>
+
+ Dashboard
+ Monitoring
+ Activity
+ Settings
+
+
+ Tab Panel 1
+ Tab Panel 2
+ Tab Panel 3
+ Tab Panel 4
+
+
+ );
+};
Default.args = {
contained: false,
@@ -98,9 +100,7 @@ Default.argTypes = {
},
},
dismissable: {
- control: {
- type: 'boolean',
- },
+ control: false,
},
iconSize: {
control: { type: 'select' },
@@ -148,9 +148,9 @@ export const Dismissable = () => {
disabled: true,
},
];
- const [renderedTabs, setRenderedTabs] = useState(tabs);
+ const [renderedTabs, setRenderedTabs] = React.useState(tabs);
- const [selectedIndex, setSelectedIndex] = useState(0);
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
const handleTabChange = (evt) => {
setSelectedIndex(evt.selectedIndex);
@@ -219,9 +219,9 @@ export const DismissableWithIcons = ({ contained }) => {
disabled: true,
},
];
- const [renderedTabs, setRenderedTabs] = useState(tabs);
+ const [renderedTabs, setRenderedTabs] = React.useState(tabs);
- const [selectedIndex, setSelectedIndex] = useState(0);
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
const handleTabChange = (evt) => {
setSelectedIndex(evt.selectedIndex);
@@ -272,217 +272,21 @@ export const DismissableWithIcons = ({ contained }) => {
);
};
-export const WithIcons = () => (
-
-
- Dashboard
- Monitoring
- Activity
- Analyze
-
- Settings
-
-
-
- Tab Panel 1
-
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
-
-
-);
-
-export const Manual = () => (
-
-
- Dashboard
- Monitoring
- Activity
- Analyze
- Settings
-
-
- Tab Panel 1
-
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
-
-
-);
-
-export const Icon20Only = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Tab Panel 1
- Tab Panel 2
- Tab Panel 3
- Tab Panel 4
-
-
-);
-
-export const IconOnly = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Tab Panel 1
- Tab Panel 2
- Tab Panel 3
- Tab Panel 4
-
-
-);
-
-export const Contained = () => (
-
-
- Dashboard
- Monitoring
- Activity
- Analyze
- Settings
-
-
- Tab Panel 1
-
-
-
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
-
-
-);
-
-export const ContainedWithIcons = () => (
-
-
- Dashboard
- Monitoring
- Activity
- Analyze
-
- Settings
-
-
-
- Tab Panel 1
-
-
-
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
-
-
-);
-
-export const ContainedWithSecondaryLabels = () => (
-
-
- Engage
- Analyze
- Remediate
- Assets
-
- Monitoring
-
-
-
- Tab Panel 1
-
-
+export const WithIcons = () => {
+ return (
+
+
+ Dashboard
+ Monitoring
+ Activity
+ Analyze
+
+ Settings
+
+
+
+ Tab Panel 1
+
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
-
-
-);
-
-export const ContainedWithSecondaryLabelsAndIcons = () => (
-
-
-
- Engage
-
-
- Analyze
-
-
- Remediate
-
-
- Assets
-
-
- Monitoring
-
-
-
- Tab Panel 1
-
-
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+
+
+ );
+};
+
+export const Manual = () => {
+ return (
+
+
+ Dashboard
+ Monitoring
+ Activity
+ Analyze
+ Settings
+
+
+ Tab Panel 1
+
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
-
-
-);
-
-export const ContainedFullWidth = () => (
-
-
-
-
- TLS
- Origin
- Rate limiting
- WAF
- IP Firewall
- Firewall rules
- Range
- Mutual TLS
-
-
- Tab Panel 1
-
-
-
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
- Tab Panel 6
- Tab Panel 7
- Tab Panel 8
-
-
-
-
-);
-
-export const Vertical = ({ ...args }) => (
-
-
- Dashboard
-
- Extra long label that will go two lines then truncate when it goes
- beyond the Tab length
-
- Activity
- Analyze
- Investigate
- Learn
- Settings
-
-
- Tab Panel 1
-
-
-
-
-
- Tab Panel 3
- Tab Panel 4
- Tab Panel 5
- Tab Panel 6
- Tab Panel 7
-
-
-);
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+
+
+ );
+};
+
+export const Icon20Only = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tab Panel 1
+ Tab Panel 2
+ Tab Panel 3
+ Tab Panel 4
+
+
+ );
+};
+
+export const IconOnly = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tab Panel 1
+ Tab Panel 2
+ Tab Panel 3
+ Tab Panel 4
+
+
+ );
+};
+
+export const Contained = () => {
+ return (
+
+
+ Dashboard
+ Monitoring
+ Activity
+ Analyze
+ Settings
+
+
+ Tab Panel 1
+
+
+
+
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+
+
+ );
+};
+
+export const ContainedWithIcons = () => {
+ return (
+
+
+ Dashboard
+ Monitoring
+ Activity
+ Analyze
+
+ Settings
+
+
+
+ Tab Panel 1
+
+
+
+
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+
+
+ );
+};
+
+export const ContainedWithSecondaryLabels = () => {
+ return (
+
+
+ Engage
+ Analyze
+ Remediate
+ Assets
+
+ Monitoring
+
+
+
+ Tab Panel 1
+
+
+
+
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+
+
+ );
+};
+
+export const ContainedWithSecondaryLabelsAndIcons = () => {
+ return (
+
+
+
+ Engage
+
+
+ Analyze
+
+
+ Remediate
+
+
+ Assets
+
+
+ Monitoring
+
+
+
+ Tab Panel 1
+
+
+
+
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+
+
+ );
+};
+
+export const ContainedFullWidth = () => {
+ return (
+
+
+
+
+ TLS
+ Origin
+ Rate limiting
+ WAF
+ IP Firewall
+ Firewall rules
+ Range
+ Mutual TLS
+
+
+ Tab Panel 1
+
+
+
+
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+ Tab Panel 6
+ Tab Panel 7
+ Tab Panel 8
+
+
+
+
+ );
+};
+
+export const Vertical = (args) => {
+ return (
+
+
+ Dashboard
+
+ Extra long label that will go two lines then truncate when it goes
+ beyond the Tab length
+
+ Activity
+ Analyze
+ Investigate
+ Learn
+ Settings
+
+
+ Tab Panel 1
+
+
+
+
+
+ Tab Panel 3
+ Tab Panel 4
+ Tab Panel 5
+ Tab Panel 6
+ Tab Panel 7
+
+
+ );
+};
Vertical.args = {
height: '',
diff --git a/packages/react/src/components/Tag/InteractiveTag.stories.js b/packages/react/src/components/Tag/InteractiveTag.stories.js
index d9d5e9a63c04..3ee9c014e2c1 100644
--- a/packages/react/src/components/Tag/InteractiveTag.stories.js
+++ b/packages/react/src/components/Tag/InteractiveTag.stories.js
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
-import React, { useState } from 'react';
+import React from 'react';
import { default as Tag } from '.';
import { default as SelectableTag } from './SelectableTag';
import { default as OperationalTag } from './OperationalTag';
@@ -47,7 +47,7 @@ export const Selectable = (args) => {
},
];
- const [selectedTags, setSelectedTags] = useState([
+ const [selectedTags, setSelectedTags] = React.useState([
{
id: 2,
text: 'Tag content 1',
@@ -123,8 +123,8 @@ Selectable.argTypes = {
};
export const Operational = (args) => {
- const [open, setOpen] = useState(false);
- const [openHighContrast, setOpenHighContrast] = useState(false);
+ const [open, setOpen] = React.useState(false);
+ const [openHighContrast, setOpenHighContrast] = React.useState(false);
return (
<>
@@ -227,11 +227,11 @@ export const Operational = (args) => {
{...args}
/>
- Tag 1 name
- Tag 2 name
- Tag 3 name
- Tag 4 name
- Tag 5 name
+ Tag 1 name
+ Tag 2 name
+ Tag 3 name
+ Tag 4 name
+ Tag 5 name
@@ -380,7 +380,7 @@ export const Dismissible = (args) => {
},
];
- const [renderedTags, setRenderedTags] = useState(tags);
+ const [renderedTags, setRenderedTags] = React.useState(tags);
const handleClose = (removedTag) => {
const newTags = renderedTags.filter((tag) => tag !== removedTag);
diff --git a/packages/react/src/components/Tag/Tag.mdx b/packages/react/src/components/Tag/Tag.mdx
index 30816cbeb6c1..d5cbaabd3f54 100644
--- a/packages/react/src/components/Tag/Tag.mdx
+++ b/packages/react/src/components/Tag/Tag.mdx
@@ -1,6 +1,7 @@
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as TagStories from './Tag.stories';
import * as InteractiveTagStories from './InteractiveTag.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -24,7 +25,15 @@ Read-only tags are used to categorize, are used for labeling, and do not have
interactive functionality. Read-only tags come in several color choices and can
use optional decorative icons to delineate between multiple categories.
-
+ stackblitzPrefillConfig(TagStories.ReadOnly),
+ },
+ ]}
+/>
## Dismissible
@@ -35,7 +44,15 @@ When to use:
- Use DismissibleTag when you want to allow users to easily clear or dismiss
specific filters applied to items.
-
+ stackblitzPrefillConfig(TagStories.ReadOnly),
+ },
+ ]}
+/>
Here it is a sample code to help you get started.
@@ -108,7 +125,15 @@ When to use:
need to be a little more specific around filtering for selectable versus
dismissable tags).
-
+ stackblitzPrefillConfig(InteractiveTagStories.Selectable),
+ },
+ ]}
+/>
Here it is a sample code to help you get started.
@@ -182,7 +207,15 @@ When not to use:
- Do not use in combination with Dismissable tags. Instead, consider letting the
user enter an "edit mode" to dismiss tags.
-
+ stackblitzPrefillConfig(InteractiveTagStories.Operational),
+ },
+ ]}
+/>
## With AI Label
@@ -190,8 +223,24 @@ Tag with AI label is now stable for Read Only tags. This addition changes the
visual appearance of the component and introduces an AI explainability feature
when AI is present in the component.
-
+ stackblitzPrefillConfig(TagStories.withAILabel),
+ },
+ ]}
+/>
## Skeleton
-
+ stackblitzPrefillConfig(TagStories.Skeleton),
+ },
+ ]}
+/>
diff --git a/packages/react/src/components/Tag/Tag.stories.js b/packages/react/src/components/Tag/Tag.stories.js
index 9339fc7bc17e..ee4100fc58ba 100644
--- a/packages/react/src/components/Tag/Tag.stories.js
+++ b/packages/react/src/components/Tag/Tag.stories.js
@@ -185,69 +185,74 @@ Skeleton.argTypes = {
},
};
-const aiLabel = (
-
-
-
-
AI Explained
-
84%
-
Confidence score
-
- Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed do
- eiusmod tempor incididunt ut fsil labore et dolore magna aliqua.
-
-
-
Model type
-
Foundation model
-
-
-
-
-
-
-
-
-
-
-
- View details
-
-
-
-);
+export const withAILabel = () => {
+ const aiLabel = () => {
+ return (
+
+
+
+
AI Explained
+
84%
+
Confidence score
+
+ Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed
+ do eiusmod tempor incididunt ut fsil labore et dolore magna
+ aliqua.
+
+
+
Model type
+
Foundation model
+
+
+
+
+
+
+
+
+
+
+
+ View details
+
+
+
+ );
+ };
-export const withAILabel = () => (
-
-
- {'Tag'}
-
+ return (
+
+
+ {'Tag'}
+
-
+
-
- {'Tag'}
-
+
+ {'Tag'}
+
-
-
-);
+
+
+ );
+};
diff --git a/packages/react/src/components/Text/Text.mdx b/packages/react/src/components/Text/Text.mdx
index f03b3deed18f..3a5a04d3bb36 100644
--- a/packages/react/src/components/Text/Text.mdx
+++ b/packages/react/src/components/Text/Text.mdx
@@ -1,5 +1,5 @@
import { Canvas, ArgTypes, Story, Meta } from '@storybook/blocks';
-import * as TextStories from './Text-story';
+import * as TextStories from './Text.stories';
diff --git a/packages/react/src/components/Text/Text-story.js b/packages/react/src/components/Text/Text.stories.js
similarity index 67%
rename from packages/react/src/components/Text/Text-story.js
rename to packages/react/src/components/Text/Text.stories.js
index 5a983c9e1447..67927395aeb1 100644
--- a/packages/react/src/components/Text/Text-story.js
+++ b/packages/react/src/components/Text/Text.stories.js
@@ -27,40 +27,44 @@ export default {
},
};
-export const Default = () => (
- <>
-
- Hello world
-
-
- لكن لا بد أن أوضح لك أن كل
-
- >
-);
+export const Default = () => {
+ return (
+ <>
+
+ Hello world
+
+
+ لكن لا بد أن أوضح لك أن كل
+
+ >
+ );
+};
-export const LayoutAndText = () => (
-
-
- Ipsum ipsa repellat doloribus magni architecto totam Laborum maxime
- ratione nobis voluptatibus facilis nostrum, necessitatibus magnam Maxime
- esse consequatur nemo sit repellat Dignissimos rem nobis hic reprehenderit
- ducimus? Fuga voluptatem?
-
-
-
- المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل
- لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب
- الشعور بالسعادة، ولكن بفضل هؤ.
-
+export const LayoutAndText = () => {
+ return (
+
+
+ Ipsum ipsa repellat doloribus magni architecto totam Laborum maxime
+ ratione nobis voluptatibus facilis nostrum, necessitatibus magnam Maxime
+ esse consequatur nemo sit repellat Dignissimos rem nobis hic
+ reprehenderit ducimus? Fuga voluptatem?
+
+
+
+ المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك
+ التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره
+ أو يتجنب الشعور بالسعادة، ولكن بفضل هؤ.
+
+
+
+ Ipsum ipsa repellat doloribus magni architecto totam Laborum maxime
+ ratione nobis voluptatibus facilis nostrum, necessitatibus magnam Maxime
+ esse consequatur nemo sit repellat Dignissimos rem nobis hic
+ reprehenderit ducimus? Fuga voluptatem?
+
-
- Ipsum ipsa repellat doloribus magni architecto totam Laborum maxime
- ratione nobis voluptatibus facilis nostrum, necessitatibus magnam Maxime
- esse consequatur nemo sit repellat Dignissimos rem nobis hic reprehenderit
- ducimus? Fuga voluptatem?
-
-
-);
+ );
+};
export const SetTextDirection = () => {
const legendText = 'הכותרת שלי!';
diff --git a/packages/react/src/components/TextInput/TextInput.mdx b/packages/react/src/components/TextInput/TextInput.mdx
index e81821763a55..ff72c42e8435 100644
--- a/packages/react/src/components/TextInput/TextInput.mdx
+++ b/packages/react/src/components/TextInput/TextInput.mdx
@@ -1,6 +1,7 @@
import { ArgTypes, Canvas, Story, Meta } from '@storybook/blocks';
import * as TextInputStories from './TextInput.stories';
import * as PasswordInputStories from './PasswordInput.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -22,11 +23,27 @@ default text input is for short, one-line content.
### Fluid
-
+ stackblitzPrefillConfig(TextInputStories.Fluid),
+ },
+ ]}
+/>
### Read Only
-
+ stackblitzPrefillConfig(TextInputStories.ReadOnly),
+ },
+ ]}
+/>
### With Layer
diff --git a/packages/react/src/components/TextInput/TextInput.stories.js b/packages/react/src/components/TextInput/TextInput.stories.js
index 1b064b752523..b5db1c064269 100644
--- a/packages/react/src/components/TextInput/TextInput.stories.js
+++ b/packages/react/src/components/TextInput/TextInput.stories.js
@@ -140,11 +140,13 @@ Default.argTypes = {
...sharedArgTypes,
};
-export const Fluid = () => (
-
-
-
-);
+export const Fluid = () => {
+ return (
+
+
+
+ );
+};
export const ReadOnly = () => {
return (
diff --git a/packages/react/src/components/Tile/Tile.mdx b/packages/react/src/components/Tile/Tile.mdx
index 8312de5f5200..83f30866da82 100644
--- a/packages/react/src/components/Tile/Tile.mdx
+++ b/packages/react/src/components/Tile/Tile.mdx
@@ -1,6 +1,7 @@
import { Story, ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as TileStories from './Tile.stories';
import * as TileFeatureFlagStories from './Tile.featureflag.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -16,31 +17,88 @@ import * as TileFeatureFlagStories from './Tile.featureflag.stories';
## Overview
-
+ stackblitzPrefillConfig(TileStories.Default),
+ },
+ ]}
+/>
## Clickable
-
+ stackblitzPrefillConfig(TileStories.Clickable),
+ },
+ ]}
+/>
## Expandable
-
+ stackblitzPrefillConfig(TileStories.Expandable),
+ },
+ ]}
+/>
## Expandable with Interactive
-
+
+ stackblitzPrefillConfig(TileStories.ExpandableWithInteractive),
+ },
+ ]}
+/>
## Multi Select
-
+ stackblitzPrefillConfig(TileStories.Selectable),
+ },
+ ]}
+/>
## Multi Select
-
+ stackblitzPrefillConfig(TileStories.MultiSelect),
+ },
+ ]}
+/>
## Radio
-
+ stackblitzPrefillConfig(TileStories.Radio),
+ },
+ ]}
+/>
## Experimental Improved Contrast
diff --git a/packages/react/src/components/Tile/Tile.stories.js b/packages/react/src/components/Tile/Tile.stories.js
index 07e586845247..6165a150f0c2 100644
--- a/packages/react/src/components/Tile/Tile.stories.js
+++ b/packages/react/src/components/Tile/Tile.stories.js
@@ -36,6 +36,8 @@ import { AILabel, AILabelContent, AILabelActions } from '../AILabel';
import { IconButton } from '../IconButton';
import { Tooltip } from '../Tooltip';
+import mdx from './Tile.mdx';
+
export default {
title: 'Components/Tile',
component: Tile,
@@ -60,6 +62,11 @@ export default {
},
},
},
+ parameters: {
+ docs: {
+ page: mdx,
+ },
+ },
};
export const Default = () => {
@@ -258,66 +265,72 @@ export const RadioWithLayer = () => (
);
-export const Expandable = () => (
-
-
-
- Above the fold content here
-
-
- Below the fold content here
-
-
-
-);
+export const Expandable = () => {
+ return (
+
+
+
+ Above the fold content here
+
+
+ Below the fold content here
+
+
+
+ );
+};
-export const ExpandableWithInteractive = () => (
-
-
console.log('click')}
- id="expandable-tile-1"
- tileCollapsedIconText="Interact to Expand tile"
- tileExpandedIconText="Interact to Collapse tile">
-
-
- Above the fold content here
-
-
Example
+export const ExpandableWithInteractive = () => {
+ return (
+
+
console.log('click')}
+ id="expandable-tile-1"
+ tileCollapsedIconText="Interact to Expand tile"
+ tileExpandedIconText="Interact to Collapse tile">
+
+
+ Above the fold content here
+
+ Example
+
-
-
-
-
- Below the fold content here
-
-
-
-
-
-);
+
+
+
+ Below the fold content here
+
+
+
+
+
+ );
+};
-export const ExpandableWithLayer = () => (
-
- {(layer) => (
-
-
-
- Above the fold content here
-
-
- Below the fold content here
-
-
-
- )}
-
-);
+export const ExpandableWithLayer = () => {
+ return (
+
+ {(layer) => (
+
+
+
+ Above the fold content here
+
+
+ Below the fold content here
+
+
+
+ )}
+
+ );
+};
const aiLabel = (
diff --git a/packages/react/src/components/Tooltip/DefinitionTooltip.mdx b/packages/react/src/components/Tooltip/DefinitionTooltip.mdx
index ee3ae85847df..ff3981dc76b8 100644
--- a/packages/react/src/components/Tooltip/DefinitionTooltip.mdx
+++ b/packages/react/src/components/Tooltip/DefinitionTooltip.mdx
@@ -1,5 +1,6 @@
import { Story, ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as DefinitionTooltipStories from './DefinitionTooltip.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -34,7 +35,15 @@ The `DefinitionTooltip` is made up of two parts: a term and the tooltip itself.
You can customize the contents of the tooltip through the `definition` prop. You
can customize the term by providing your own `children` to this component.
-
+ stackblitzPrefillConfig(DefinitionTooltipStories.Default),
+ },
+ ]}
+/>
### Customizing the content of a definition tooltip
diff --git a/packages/react/src/components/Tooltip/Tooltip.mdx b/packages/react/src/components/Tooltip/Tooltip.mdx
index 4fa2da5298e8..23ff0158dc07 100644
--- a/packages/react/src/components/Tooltip/Tooltip.mdx
+++ b/packages/react/src/components/Tooltip/Tooltip.mdx
@@ -1,5 +1,6 @@
import { Story, ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as TooltipStories from './Tooltip.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -42,7 +43,15 @@ can provide the interactive element as a child to `Tooltip`, for example:
the component you provide renders an interactive element. In addition, you can
specify the contents of the popup through the `label` or `description` prop.
-
+ stackblitzPrefillConfig(TooltipStories.Default),
+ },
+ ]}
+/>
### Toggletips vs Tooltips
@@ -79,7 +88,15 @@ relative to the tooltip. For example, if you provide `align="top"` to the
Similarly, if you provide `align="bottom"` then the tooltip will render below
your component.
-
+ stackblitzPrefillConfig(TooltipStories.Alignment),
+ },
+ ]}
+/>
You can also configure the placement of the caret, if it is enabled, by choosing
between `left` and `right` or `bottom` and `top`, depending on where your
@@ -98,7 +115,15 @@ You can customize the delay between when a tooltip is invoked and its contents
are shown. You can also customize the delay between when a tooltip is dismissed
and its contents are hidden.
-
+ stackblitzPrefillConfig(TooltipStories.Duration),
+ },
+ ]}
+/>
The `enterDelayMs` prop allows you to provide a time, in milliseconds, that the
component will wait before showing the tooltip. The `exitDelayMs` prop allows
diff --git a/packages/react/src/components/TreeView/TreeView.mdx b/packages/react/src/components/TreeView/TreeView.mdx
index 5140818a0ae3..b2603d074a73 100644
--- a/packages/react/src/components/TreeView/TreeView.mdx
+++ b/packages/react/src/components/TreeView/TreeView.mdx
@@ -1,5 +1,6 @@
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as TreeViewStories from './Treeview.stories';
+import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
@@ -19,7 +20,19 @@ TreeView is a component that allows users to navigate through a hierarchy of
items. It is used to display nested lists of items that can be expanded or
collapsed to show and hide additional items.
-
+
+ stackblitzPrefillConfig(
+ TreeViewStories.Default,
+ "import { Document, Folder } from '@carbon/icons-react';"
+ ),
+ },
+ ]}
+/>
## With Controlled Expansion
@@ -27,14 +40,38 @@ The `expanded` prop can be used to control the expansion state of the TreeView.
The `isExpanded` prop can be used to determine if an individual tree node is
expanded or collapsed.
-
+
+ stackblitzPrefillConfig(
+ TreeViewStories.WithControlledExpansion,
+ "import { Document, Folder } from '@carbon/icons-react';"
+ ),
+ },
+ ]}
+/>
## With Custom Icons
The `renderIcon` prop can be used to customize the icons of each node in the
TreeView.
-
+
+ stackblitzPrefillConfig(
+ TreeViewStories.WithIcons,
+ "import { Document, Folder } from '@carbon/icons-react';"
+ ),
+ },
+ ]}
+/>
## Component API
diff --git a/packages/react/src/components/TreeView/Treeview.stories.js b/packages/react/src/components/TreeView/Treeview.stories.js
index 94339625b5c9..b383d808d630 100644
--- a/packages/react/src/components/TreeView/Treeview.stories.js
+++ b/packages/react/src/components/TreeView/Treeview.stories.js
@@ -223,11 +223,182 @@ export default {
},
};
-export const Default = (args) => (
-
- {renderTree({ nodes })}
-
-);
+export const Default = (args) => {
+ const nodes = [
+ {
+ id: '1',
+ value: 'Artificial intelligence',
+ label: Artificial intelligence ,
+ renderIcon: Document,
+ },
+ {
+ id: '2',
+ value: 'Blockchain',
+ label: 'Blockchain',
+ renderIcon: Document,
+ },
+ {
+ id: '3',
+ value: 'Business automation',
+ label: 'Business automation',
+ renderIcon: Folder,
+ children: [
+ {
+ id: '3-1',
+ value: 'Business process automation',
+ label: 'Business process automation',
+ renderIcon: Document,
+ },
+ {
+ id: '3-2',
+ value: 'Business process mapping',
+ label: 'Business process mapping',
+ renderIcon: Document,
+ },
+ ],
+ },
+ {
+ id: '4',
+ value: 'Business operations',
+ label: 'Business operations',
+ renderIcon: Document,
+ },
+ {
+ id: '5',
+ value: 'Cloud computing',
+ label: 'Cloud computing',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-1',
+ value: 'Containers',
+ label: 'Containers',
+ renderIcon: Document,
+ },
+ {
+ id: '5-2',
+ value: 'Databases',
+ label: 'Databases',
+ renderIcon: Document,
+ },
+ {
+ id: '5-3',
+ value: 'DevOps',
+ label: 'DevOps',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-4',
+ value: 'Solutions',
+ label: 'Solutions',
+ renderIcon: Document,
+ },
+ {
+ id: '5-5',
+ value: 'Case studies',
+ label: 'Case studies',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-6',
+ value: 'Resources',
+ label: 'Resources',
+ renderIcon: Document,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ id: '6',
+ value: 'Data & Analytics',
+ label: 'Data & Analytics',
+ renderIcon: Folder,
+ children: [
+ {
+ id: '6-1',
+ value: 'Big data',
+ label: 'Big data',
+ renderIcon: Document,
+ },
+ {
+ id: '6-2',
+ value: 'Business intelligence',
+ label: 'Business intelligence',
+ renderIcon: Document,
+ },
+ ],
+ },
+ {
+ id: '7',
+ value: 'Models',
+ label: 'Models',
+ isExpanded: true,
+ disabled: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '7-1',
+ value: 'Audit',
+ label: 'Audit',
+ renderIcon: Document,
+ },
+ {
+ id: '7-2',
+ value: 'Monthly data',
+ label: 'Monthly data',
+ renderIcon: Document,
+ },
+ {
+ id: '8',
+ value: 'Data warehouse',
+ label: 'Data warehouse',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '8-1',
+ value: 'Report samples',
+ label: 'Report samples',
+ renderIcon: Document,
+ },
+ {
+ id: '8-2',
+ value: 'Sales performance',
+ label: 'Sales performance',
+ renderIcon: Document,
+ },
+ ],
+ },
+ ],
+ },
+ ];
+
+ function renderTree({ nodes, expanded, withIcons = false }) {
+ if (!nodes) {
+ return;
+ }
+ return nodes.map(({ children, renderIcon, isExpanded, ...nodeProps }) => (
+
+ {renderTree({ nodes: children, expanded, withIcons })}
+
+ ));
+ }
+ return (
+
+ {renderTree({ nodes })}
+
+ );
+};
Default.args = {
hideLabel: false,
@@ -242,14 +413,356 @@ Default.argTypes = {
},
};
-export const WithIcons = () => (
-
- {renderTree({ nodes, withIcons: true })}
-
-);
+export const WithIcons = () => {
+ const nodes = [
+ {
+ id: '1',
+ value: 'Artificial intelligence',
+ label: Artificial intelligence ,
+ renderIcon: Document,
+ },
+ {
+ id: '2',
+ value: 'Blockchain',
+ label: 'Blockchain',
+ renderIcon: Document,
+ },
+ {
+ id: '3',
+ value: 'Business automation',
+ label: 'Business automation',
+ renderIcon: Folder,
+ children: [
+ {
+ id: '3-1',
+ value: 'Business process automation',
+ label: 'Business process automation',
+ renderIcon: Document,
+ },
+ {
+ id: '3-2',
+ value: 'Business process mapping',
+ label: 'Business process mapping',
+ renderIcon: Document,
+ },
+ ],
+ },
+ {
+ id: '4',
+ value: 'Business operations',
+ label: 'Business operations',
+ renderIcon: Document,
+ },
+ {
+ id: '5',
+ value: 'Cloud computing',
+ label: 'Cloud computing',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-1',
+ value: 'Containers',
+ label: 'Containers',
+ renderIcon: Document,
+ },
+ {
+ id: '5-2',
+ value: 'Databases',
+ label: 'Databases',
+ renderIcon: Document,
+ },
+ {
+ id: '5-3',
+ value: 'DevOps',
+ label: 'DevOps',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-4',
+ value: 'Solutions',
+ label: 'Solutions',
+ renderIcon: Document,
+ },
+ {
+ id: '5-5',
+ value: 'Case studies',
+ label: 'Case studies',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-6',
+ value: 'Resources',
+ label: 'Resources',
+ renderIcon: Document,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ id: '6',
+ value: 'Data & Analytics',
+ label: 'Data & Analytics',
+ renderIcon: Folder,
+ children: [
+ {
+ id: '6-1',
+ value: 'Big data',
+ label: 'Big data',
+ renderIcon: Document,
+ },
+ {
+ id: '6-2',
+ value: 'Business intelligence',
+ label: 'Business intelligence',
+ renderIcon: Document,
+ },
+ ],
+ },
+ {
+ id: '7',
+ value: 'Models',
+ label: 'Models',
+ isExpanded: true,
+ disabled: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '7-1',
+ value: 'Audit',
+ label: 'Audit',
+ renderIcon: Document,
+ },
+ {
+ id: '7-2',
+ value: 'Monthly data',
+ label: 'Monthly data',
+ renderIcon: Document,
+ },
+ {
+ id: '8',
+ value: 'Data warehouse',
+ label: 'Data warehouse',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '8-1',
+ value: 'Report samples',
+ label: 'Report samples',
+ renderIcon: Document,
+ },
+ {
+ id: '8-2',
+ value: 'Sales performance',
+ label: 'Sales performance',
+ renderIcon: Document,
+ },
+ ],
+ },
+ ],
+ },
+ ];
+
+ function renderTree({ nodes, expanded, withIcons = false }) {
+ if (!nodes) {
+ return;
+ }
+ return nodes.map(({ children, renderIcon, isExpanded, ...nodeProps }) => (
+
+ {renderTree({ nodes: children, expanded, withIcons })}
+
+ ));
+ }
+ return (
+
+ {renderTree({ nodes, withIcons: true })}
+
+ );
+};
export const WithControlledExpansion = () => {
- const [expanded, setExpanded] = useState(undefined);
+ const nodes = [
+ {
+ id: '1',
+ value: 'Artificial intelligence',
+ label: Artificial intelligence ,
+ renderIcon: Document,
+ },
+ {
+ id: '2',
+ value: 'Blockchain',
+ label: 'Blockchain',
+ renderIcon: Document,
+ },
+ {
+ id: '3',
+ value: 'Business automation',
+ label: 'Business automation',
+ renderIcon: Folder,
+ children: [
+ {
+ id: '3-1',
+ value: 'Business process automation',
+ label: 'Business process automation',
+ renderIcon: Document,
+ },
+ {
+ id: '3-2',
+ value: 'Business process mapping',
+ label: 'Business process mapping',
+ renderIcon: Document,
+ },
+ ],
+ },
+ {
+ id: '4',
+ value: 'Business operations',
+ label: 'Business operations',
+ renderIcon: Document,
+ },
+ {
+ id: '5',
+ value: 'Cloud computing',
+ label: 'Cloud computing',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-1',
+ value: 'Containers',
+ label: 'Containers',
+ renderIcon: Document,
+ },
+ {
+ id: '5-2',
+ value: 'Databases',
+ label: 'Databases',
+ renderIcon: Document,
+ },
+ {
+ id: '5-3',
+ value: 'DevOps',
+ label: 'DevOps',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-4',
+ value: 'Solutions',
+ label: 'Solutions',
+ renderIcon: Document,
+ },
+ {
+ id: '5-5',
+ value: 'Case studies',
+ label: 'Case studies',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '5-6',
+ value: 'Resources',
+ label: 'Resources',
+ renderIcon: Document,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ id: '6',
+ value: 'Data & Analytics',
+ label: 'Data & Analytics',
+ renderIcon: Folder,
+ children: [
+ {
+ id: '6-1',
+ value: 'Big data',
+ label: 'Big data',
+ renderIcon: Document,
+ },
+ {
+ id: '6-2',
+ value: 'Business intelligence',
+ label: 'Business intelligence',
+ renderIcon: Document,
+ },
+ ],
+ },
+ {
+ id: '7',
+ value: 'Models',
+ label: 'Models',
+ isExpanded: true,
+ disabled: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '7-1',
+ value: 'Audit',
+ label: 'Audit',
+ renderIcon: Document,
+ },
+ {
+ id: '7-2',
+ value: 'Monthly data',
+ label: 'Monthly data',
+ renderIcon: Document,
+ },
+ {
+ id: '8',
+ value: 'Data warehouse',
+ label: 'Data warehouse',
+ isExpanded: true,
+ renderIcon: Folder,
+ children: [
+ {
+ id: '8-1',
+ value: 'Report samples',
+ label: 'Report samples',
+ renderIcon: Document,
+ },
+ {
+ id: '8-2',
+ value: 'Sales performance',
+ label: 'Sales performance',
+ renderIcon: Document,
+ },
+ ],
+ },
+ ],
+ },
+ ];
+
+ const [expanded, setExpanded] = React.useState(undefined);
+
+ function renderTree({ nodes, expanded, withIcons = false }) {
+ if (!nodes) {
+ return;
+ }
+ return nodes.map(({ children, renderIcon, isExpanded, ...nodeProps }) => (
+
+ {renderTree({ nodes: children, expanded, withIcons })}
+
+ ));
+ }
+
return (
<>