@ark-ui/solid
Version:
A collection of unstyled, accessible UI components for Solid, utilizing state machines for seamless interaction.
40 lines (37 loc) • 1.54 kB
TypeScript
import * as solid_js from 'solid-js';
import { M as MaybeAccessor } from './types-Bc0WfPsv.js';
import { CollectionOptions, ListCollection } from '@zag-js/collection';
interface UseListCollectionProps<T> extends Omit<CollectionOptions<T>, 'items'> {
/**
* The initial items to display in the collection.
*/
initialItems: T[];
/**
* The filter function to use to filter the items.
*/
filter?: (itemText: string, filterText: string) => boolean;
/**
* The maximum number of items to display in the collection.
* Useful for performance when you have a large number of items.
*/
limit?: number;
}
declare function useListCollection<T>(props: MaybeAccessor<UseListCollectionProps<T>>): {
collection: solid_js.Accessor<ListCollection<T>>;
filter: (inputValue: string) => void;
set: (items: T[]) => void;
reset: () => void;
clear: () => void;
insert: (index: number, ...items: T[]) => void;
insertBefore: (value: string, ...items: T[]) => void;
insertAfter: (value: string, ...items: T[]) => void;
remove: (...itemOrValues: T[]) => void;
move: (value: string, to: number) => void;
moveBefore: (value: string, ...values: string[]) => void;
moveAfter: (value: string, ...values: string[]) => void;
reorder: (from: number, to: number) => void;
append: (...items: T[]) => void;
prepend: (...items: T[]) => void;
update: (value: string, item: T) => void;
};
export { type UseListCollectionProps as U, useListCollection as u };