Files
heroui-vue/packages/vue/src/components/collection/match.ts
T
maoyingjie e34b9debdf fix(pickers): rework B02 against the public review
Restore native clearing, unify the form/field protocol with the other choice
families (per-key entries, disabled and removed keys omitted, shared form
owner), synchronise ComboBox text by key identity, keep filtering out of open
composition sessions, and stop stealing focus when a controlled close is
rejected. Also merge caller refs/ARIA/disabled, implement asChild, autoFocus
and ComboBox variant, use a locale-aware base matcher, and put the indicator
class and slot on the icon element the ported CSS selects.
2026-10-25 20:40:24 +08:00

16 lines
530 B
TypeScript

/**
* Case- and accent-insensitive substring match, the equivalent of ICU
* "base" sensitivity for search: `Café` matches `cafe`, `STRASSE` matches
* `strasse` after compatibility normalisation.
*/
const fold = (value: string) => value.normalize("NFKD").replace(/\p{Mn}/gu, "");
export function createBaseContains(locale?: string) {
return (text: string, query: string) => {
if (!query) return true;
return fold(text)
.toLocaleLowerCase(locale)
.includes(fold(query).toLocaleLowerCase(locale));
};
}