From 03574ef822202ea3e223d7032005d7cff42bee89 Mon Sep 17 00:00:00 2001
From: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com>
Date: Thu, 19 Dec 2024 12:00:34 +0530
Subject: [PATCH] fix: show "No matches found" when palette has no matching
items (#1110)
---
src/components/inputhints/index.js | 20 ++++++++++++++------
src/components/inputhints/style.scss | 8 ++++----
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/components/inputhints/index.js b/src/components/inputhints/index.js
index 08d15a45d..76e5ffcc2 100644
--- a/src/components/inputhints/index.js
+++ b/src/components/inputhints/index.js
@@ -70,7 +70,10 @@ export default function inputhints($input, hints, onSelect) {
const action = $el.getAttribute("action");
if (action !== "hint") return;
const value = $el.getAttribute("value");
- if (!value) return;
+ if (!value) {
+ onblur();
+ return;
+ }
$input.value = $el.textContent;
if (onSelect) onSelect(value);
preventUpdate = false;
@@ -304,14 +307,19 @@ export default function inputhints($input, hints, onSelect) {
const end = offset + LIMIT;
const list = hints.slice(offset, end);
let scrollTop = $ul.scrollTop;
- if (!list.length) return;
+ //if (!list.length) return;
$ul.remove();
- if (!page) {
- scrollTop = 0;
- $ul.content = list.map((hint) => );
+
+ if (!list.length) {
+ $ul.content = [];
} else {
- $ul.append(...list.map((hint) => ));
+ if (!page) {
+ scrollTop = 0;
+ $ul.content = list.map((hint) => );
+ } else {
+ $ul.append(...list.map((hint) => ));
+ }
}
app.append($ul);
$ul.scrollTop = scrollTop;
diff --git a/src/components/inputhints/style.scss b/src/components/inputhints/style.scss
index 6f07606d8..a4deb7121 100644
--- a/src/components/inputhints/style.scss
+++ b/src/components/inputhints/style.scss
@@ -1,4 +1,4 @@
-@import '../../styles/mixins.scss';
+@import "../../styles/mixins.scss";
#hints {
position: fixed;
@@ -29,8 +29,8 @@
border-radius: 4px;
}
- [data-action='hint'],
- [action='hint'] {
+ [data-action="hint"],
+ [action="hint"] {
font-size: 0.9rem;
min-height: 30px;
height: fit-content;
@@ -88,4 +88,4 @@
&:empty {
display: none;
}
-}
\ No newline at end of file
+}