carbon-components-svelte
Version:
Svelte implementation of the Carbon Design System
77 lines (64 loc) • 2.29 kB
TypeScript
import { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";
export type CarbonStructuredListWrapperContext<Value extends string = string, Icon = any> = {
selectedValue: import("svelte/store").Writable<Value | Value[] | undefined>;
update: (value: Value) => void;
/** Set to `true` to allow selecting multiple rows */
multiple: boolean;
/** Set to `true` to use the selection variant */
selection: boolean;
/** Specify the icon rendered in the selection column of selectable rows.
Only used when `selection` is `true`.
The icon is decorative; selection state is conveyed by each row's `aria-checked`. */
icon: Icon;
};
type $RestProps = SvelteHTMLElements["div"];
type $Props<Value extends string = string, Icon = any> = {
/**
* Specify the selected structured list row value.
* When `multiple` is `true`, this is an array of selected values.
* @default undefined
*/
selected?: Value | Value[] | undefined;
/**
* Set to `true` to use the condensed variant
* @default false
*/
condensed?: boolean;
/**
* Set to `true` to flush the list
* @default false
*/
flush?: boolean;
/**
* Set to `true` to use the selection variant
* @default false
*/
selection?: boolean;
/**
* Set to `true` to allow selecting multiple rows
* @default false
*/
multiple?: boolean;
/**
* Specify the icon rendered in the selection column of selectable rows.
* Only used when `selection` is `true`.
* The icon is decorative; selection state is conveyed by each row's `aria-checked`.
* @default CheckmarkFilled
*/
icon?: Icon;
children?: (this: void) => void;
[key: `data-${string}`]: unknown;
};
export type StructuredListProps<Value extends string = string, Icon = any> = Omit<$RestProps, keyof $Props<Value, Icon>> & $Props<Value, Icon>;
export default class StructuredList<Value extends string = string, Icon = any> extends SvelteComponentTyped<
StructuredListProps<Value, Icon>,
{
change: CustomEvent<Value | Value[]>;
click: WindowEventMap["click"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
mouseover: WindowEventMap["mouseover"];
},
{ default: Record<string, never> }
> {}