feat(recursive-list): add RecursiveList

This commit is contained in:
Eric Y Liu 2021-06-30 05:41:37 -07:00
commit 92301b1d46
10 changed files with 254 additions and 3 deletions

View file

@ -1,5 +1,5 @@
{
"total": 168,
"total": 169,
"components": [
{
"moduleName": "Accordion",
@ -7864,6 +7864,52 @@
"typedefs": [],
"rest_props": { "type": "Element", "name": "label" }
},
{
"moduleName": "RecursiveList",
"filePath": "src/RecursiveList/RecursiveList.svelte",
"props": [
{
"name": "items",
"kind": "let",
"description": "Specify the items to render",
"type": "Array<Item & { items?: Item[]; }>",
"value": "[]",
"isFunction": false,
"constant": false,
"reactive": false
},
{
"name": "type",
"kind": "let",
"description": "Specify the type of list to render",
"type": "\"unordered\" | \"ordered\" | \"ordered-native\"",
"value": "\"unordered\"",
"isFunction": false,
"constant": false,
"reactive": false
},
{
"name": "nested",
"kind": "let",
"description": "Set to `true` to use the nested variant",
"type": "boolean",
"value": "false",
"isFunction": false,
"constant": false,
"reactive": false
}
],
"slots": [],
"events": [],
"typedefs": [
{
"type": "{ text?: string; href?: string; html?: string; }",
"name": "Item",
"ts": "interface Item { text?: string; href?: string; html?: string; }"
}
],
"rest_props": { "type": "InlineComponent", "name": "svelte:component" }
},
{
"moduleName": "Row",
"filePath": "src/Grid/Row.svelte",

View file

@ -20,7 +20,7 @@
import Footer from "../components/Footer.svelte";
const deprecated = ["ToggleSmall", "Icon"];
const new_components = ["ProgressBar"];
const new_components = ["ProgressBar", "RecursiveList"];
let isOpen = false;
let isSideNavOpen = true;

View file

@ -0,0 +1,78 @@
<script>
import { RecursiveList } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Unordered
<RecursiveList
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
### Ordered
<RecursiveList
type="ordered"
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
### Ordered (native styles)
<RecursiveList
type="ordered-native"
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>