// @ts-nocheck import * as mod from "./list" import { create } from "../storybook/scaffold" const docs = `### Overview Filterable list with keyboard navigation and optional search input. Use within panels or popovers where keyboard navigation is expected. ### API - Required: \`items\` and \`key\`. - Required: \`children\` render function for items. - Optional: \`search\`, \`filterKeys\`, \`groupBy\`, \`onSelect\`, \`onKeyEvent\`. ### Variants and states - Optional search bar and group headers. ### Behavior - Uses fuzzy search when \`search\` is enabled. - Keyboard navigation via arrow keys; Enter selects. ### Accessibility - TODO: confirm ARIA roles for list items and search input. ### Theming/tokens - Uses \`data-component="list"\` and data slots for structure. ` const story = create({ title: "UI/List", mod, args: { items: ["One", "Two", "Three", "Four"], key: (x: string) => x, children: (x: string) => x, search: true, }, }) export default { title: "UI/List", id: "components-list", component: story.meta.component, tags: ["autodocs"], parameters: { docs: { description: { component: docs, }, }, }, } export const Basic = story.Basic export const Grouped = { render: () => { const items = [ { id: "a1", title: "Alpha", group: "Group A" }, { id: "a2", title: "Bravo", group: "Group A" }, { id: "b1", title: "Delta", group: "Group B" }, ] return ( item.id} groupBy={(item) => item.group} search={true}> {(item) => item.title} ) }, } export const Empty = { render: () => ( item} search={true}> {(item) => item} ), } export const WithAdd = { render: () => ( item} search={true} add={{ render: () => ( ), }} > {(item) => item} ), } export const Divider = { render: () => ( item} divider={true}> {(item) => item} ), } export const ActiveIcon = { render: () => ( item} activeIcon="chevron-right"> {(item) => item} ), } export const NoSearch = { render: () => ( item} search={false}> {(item) => item} ), } export const SearchOptions = { render: () => ( item} search={{ placeholder: "Filter...", hideIcon: true, action: , }} > {(item) => item} ), } export const ItemWrapper = { render: () => ( item} itemWrapper={(item, node) => (
{node}
)} > {(item) => item}
), } export const GroupHeader = { render: () => { const items = [ { id: "a1", title: "Alpha", group: "Group A" }, { id: "b1", title: "Beta", group: "Group B" }, ] return ( item.id} groupBy={(item) => item.group} groupHeader={(group) => {group.category}} > {(item) => item.title} ) }, }