/** * The searchable list of every die in the game, with owned quantities. */ import type { JSX } from "react"; import { DICE } from "../data/dice.ts"; import { fuzzyFilter } from "../lib/fuzzy.ts"; import { DieRow } from "./DieRow.tsx"; import type { CountUpdater } from "./QuantityStepper.tsx"; export interface DiceListProps { readonly query: string; readonly counts: Readonly>; readonly onChange: (id: string, update: CountUpdater) => void; } /** * Fuzzy-filtered list of dice. * * @param props - The search query, current counts, and a change handler. * @returns The list element, or an empty-state message. */ export function DiceList({ query, counts, onChange }: DiceListProps): JSX.Element { const matches = fuzzyFilter(query, DICE, (die) => die.name); if (matches.length === 0) { return

No die matches “{query}”.

; } return ( // `role="list"` is not redundant: the list-style:none needed for the grid // layout makes Safari/VoiceOver drop list semantics entirely. ); }