@mdbase-dev/ui 0.1.0-beta.158 → 0.1.0-beta.159

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.
@@ -106,10 +106,12 @@ function OpenCommandPalette({
106
106
  }) {
107
107
  useLocaleRevision();
108
108
  const [query, setQuery] = useState(initialQuery);
109
- const [active, setActive] = useState(0);
109
+ const [selected, setActive] = useState(0);
110
110
  const inputRef = useRef(null);
111
111
  const resultsRef = useRef(null);
112
112
  const matches = useMemo(() => getResults ? contextualCommands(getResults(query)) : matchingCommands(commands, query, showAll), [commands, query, showAll, getResults]);
113
+ // Live command updates can shrink the list under the selection.
114
+ const active = Math.min(selected, Math.max(0, matches.length - 1));
113
115
  useLayoutEffect(() => {
114
116
  resultsRef.current.querySelector('[aria-selected="true"]')?.scrollIntoView({
115
117
  block: "nearest"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/ui",
3
- "version": "0.1.0-beta.158",
3
+ "version": "0.1.0-beta.159",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -190,6 +190,6 @@
190
190
  "typecheck": "node scripts/compile-catalogues.mjs && tsc -p tsconfig.json --noEmit"
191
191
  },
192
192
  "mdbaseRelease": {
193
- "commit": "89548fc762b799ae686cb0143fe4ba11a0e537f3"
193
+ "commit": "b7856f3da7a4a49fb2be34f0dfe79d6f3f26b6a8"
194
194
  }
195
195
  }