import React from "react"; import { LogoReact } from "@carbon/icons-react"; import { Meta, StoryFn } from "@storybook/react"; import { Icon, OverflowText, Tag, TestIcon, Tree, TreeNodeInfo } from "./../../index"; import { TreeNodeShadow as TreeNode } from "./Tree"; export default { title: "Components/Tree", component: Tree, subcomponents: { TreeNode }, argTypes: {}, } as Meta; const Template: StoryFn = (args) => { const [treeContents, setTreeContents] = React.useState(args.contents); return ( ); }; export const Default = Template.bind({}); Default.args = { contents: [ { id: 0, label: "Tree item 1", isExpanded: true, childNodes: [ { id: 1, label: ( <> Tree item 1a with Tag ), }, { id: 2, label: "Tree item 1b with a very long label that is not ellipsed on overflow", }, { id: 3, label: ( Tree item 1c with a very long label that is ellipsed on overflow ), }, { id: 4, label: "Tree item 1d with icon", icon: , }, { id: 5, label: "Tree item 1e with test icon", icon: , }, ], }, { id: 5, label: "Tree item 2", hasCaret: true, }, ] as TreeNodeInfo[], };