RecursiveList (#717)

* feat(recursive-list): add RecursiveList

* feat(recursive-list): rename items prop to children

* docs(recursive-list): add full examples

* test(recursive-list): add types test

* refactor(recursive-list): remove superfluous nested prop

* docs(recursive-list): update docs

* fix(recursive-list): remove nested prop from type test

* fix(recursive-list): explicitly type restProps
This commit is contained in:
Eric Liu 2021-07-05 08:43:48 -07:00 committed by GitHub
commit ae27bedf4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 334 additions and 6 deletions

30
types/RecursiveList/RecursiveList.d.ts vendored Normal file
View file

@ -0,0 +1,30 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface RecursiveListNode {
text?: string;
href?: string;
html?: string;
}
export interface RecursiveListProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["ul"]>,
svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["ol"]> {
/**
* Specify the children to render
* @default []
*/
children?: Array<RecursiveListNode & { children?: RecursiveListNode[] }>;
/**
* Specify the type of list to render
* @default "unordered"
*/
type?: "unordered" | "ordered" | "ordered-native";
}
export default class RecursiveList extends SvelteComponentTyped<
RecursiveListProps,
{},
{}
> {}

1
types/index.d.ts vendored
View file

@ -99,6 +99,7 @@ export { default as ProgressStep } from "./ProgressIndicator/ProgressStep";
export { default as RadioButton } from "./RadioButton/RadioButton";
export { default as RadioButtonSkeleton } from "./RadioButton/RadioButtonSkeleton";
export { default as RadioButtonGroup } from "./RadioButtonGroup/RadioButtonGroup";
export { default as RecursiveList } from "./RecursiveList/RecursiveList";
export { default as Search } from "./Search/Search";
export { default as SearchSkeleton } from "./Search/SearchSkeleton";
export { default as Select } from "./Select/Select";