import * as solid_js from 'solid-js'; import { MaybeAccessor } from '@corvu/utils/reactivity'; export { MaybeAccessor } from '@corvu/utils/reactivity'; /** * Creates a keyboard navigable list. * * @param props.items The items in the list. Should be in the same order as they appear in the DOM. * @param props.initialActive The initially active item. *Default = `null`* * @param props.orientation The orientation of the list. *Default = `'vertical'`* * @param props.loop Whether the list should loop. *Default = `true`* * @param props.textDirection The text direction of the list. *Default = `'ltr'`* * @param props.handleTab Whether tab key presses should be handled. *Default = `true`* * @param props.vimMode Whether vim movement key bindings should be used additionally to arrow key navigation. *Default = `false`* * @param props.vimKeys The vim movement key bindings to use. *Default = `{ up: 'k', down: 'j', right: 'l', left: 'h' }`* * @param props.onActiveChange Callback fired when the active item changes. * @returns ```typescript * { * active: () => T | null * setActive: Setter * onKeyDown: (event: KeyboardEvent) => void * } * ``` */ declare const createList: (props: { items: MaybeAccessor; initialActive?: T | null; orientation?: MaybeAccessor<"vertical" | "horizontal">; loop?: MaybeAccessor; textDirection?: MaybeAccessor<"ltr" | "rtl">; handleTab?: MaybeAccessor; vimMode?: MaybeAccessor; vimKeys?: MaybeAccessor<{ up: string; down: string; right: string; left: string; }>; onActiveChange?: (active: T | null) => void; }) => { active: solid_js.Accessor; setActive: solid_js.Setter; onKeyDown: (event: KeyboardEvent) => void; }; /** * Creates a keyboard navigable multiselect list. * * @param props.items The items in the list. Should be in the same order as they appear in the DOM. * @param props.initialCursor The initially focused item. *Default = `null`* * @param props.initialActive The initially active items. *Default = `[]`* * @param props.initialSelected The initially selected items. *Default = `[]`* * @param props.orientation The orientation of the list. *Default = `'vertical'`* * @param props.loop Whether the list should loop. *Default = `true`* * @param props.textDirection The text direction of the list. *Default = `'ltr'`* * @param props.handleTab Whether tab key presses should be handled. *Default = `true`* * @param props.vimMode Whether vim movement key bindings should be used additionally to arrow key navigation. *Default = `false`* * @param props.vimKeys The vim movement key bindings to use. *Default = `{ up: 'k', down: 'j', right: 'l', left: 'h' }`* * @param props.onCursorChange Callback fired when the cursor changes. * @param props.onActiveChange Callback fired when the active items change. * @param props.onSelectedChange Callback fired when the selected items change. * @returns ```typescript * { * cursor: () => T | null * setCursor: Setter * active: () => T[] * setActive: Setter * setCursorActive: (item: T | null) => void * selected: () => T[] * setSelected: Setter * toggleSelected: (item: T) => void * onKeyDown: (event: KeyboardEvent) => void * } * ``` */ declare const createMultiList: (props: { items: MaybeAccessor; initialCursor?: T | null; initialActive?: T[]; initialSelected?: T[]; orientation?: MaybeAccessor<"vertical" | "horizontal">; loop?: MaybeAccessor; textDirection?: MaybeAccessor<"ltr" | "rtl">; handleTab?: MaybeAccessor; vimMode?: MaybeAccessor; vimKeys?: MaybeAccessor<{ up: string; down: string; right: string; left: string; }>; onCursorChange?: (cursor: T | null) => void; onActiveChange?: (active: T[]) => void; onSelectedChange?: (selected: T[]) => void; }) => { cursor: solid_js.Accessor; setCursor: solid_js.Setter; active: solid_js.Accessor; setActive: solid_js.Setter; setCursorActive: (item: T | null) => void; selected: solid_js.Accessor; setSelected: solid_js.Setter; toggleSelected: (item: T) => void; onKeyDown: (event: KeyboardEvent) => void; }; export { createList, createMultiList };