@bytebrand/fe-ui-core-autobahn 1.0.96 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/Dropdown.tsx +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.97",
|
|
4
4
|
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"license": "UNLICENSED",
|
package/ui/Dropdown.tsx
CHANGED
|
@@ -86,7 +86,18 @@ const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
86
86
|
const filteredOptions = React.useMemo(() => {
|
|
87
87
|
if (!searchable || !query.trim()) return options;
|
|
88
88
|
const q = query.trim().toLowerCase();
|
|
89
|
-
|
|
89
|
+
const matches = options.filter((o) => o.label.toLowerCase().includes(q));
|
|
90
|
+
// some option lists intentionally repeat entries across groups while closed (e.g. a "Top
|
|
91
|
+
// Marken" shortlist followed by the FULL "Alle Marken" list, which includes those same top
|
|
92
|
+
// brands again) — harmless when browsing both sections, but shows the same match twice while
|
|
93
|
+
// searching. Keep only the first occurrence of each label once the user is actually filtering.
|
|
94
|
+
const seen = new Set<string>();
|
|
95
|
+
return matches.filter((o) => {
|
|
96
|
+
const key = o.label.toLowerCase();
|
|
97
|
+
if (seen.has(key)) return false;
|
|
98
|
+
seen.add(key);
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
90
101
|
}, [searchable, query, options]);
|
|
91
102
|
|
|
92
103
|
// deferred: when searchable, the trigger <button> is swapped out for an <input> while
|