qt-ui-kit 1.0.45 → 1.0.46
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/dist/index.d.mts +23 -14
- package/dist/index.d.ts +23 -14
- package/dist/index.js +5 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -16426,38 +16426,20 @@ function Search({
|
|
|
16426
16426
|
// src/components/organisms/search_bar/search_bar.tsx
|
|
16427
16427
|
import { useState as useState4, useEffect as useEffect3 } from "react";
|
|
16428
16428
|
import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
16429
|
-
function SearchBar() {
|
|
16429
|
+
function SearchBar({ loading, results, onUpdate }) {
|
|
16430
16430
|
const [query, setQuery] = useState4("");
|
|
16431
|
-
const [state, setState] = useState4("inactive");
|
|
16432
|
-
const [results, setResults] = useState4([]);
|
|
16433
16431
|
useEffect3(() => {
|
|
16434
|
-
if (
|
|
16435
|
-
setState("inactive");
|
|
16436
|
-
setResults([]);
|
|
16432
|
+
if (!onUpdate) {
|
|
16437
16433
|
return;
|
|
16438
16434
|
}
|
|
16439
|
-
|
|
16440
|
-
const timeout = setTimeout(() => {
|
|
16441
|
-
setState("loading");
|
|
16442
|
-
setTimeout(() => {
|
|
16443
|
-
setState("results");
|
|
16444
|
-
setResults([
|
|
16445
|
-
{ label: "Unread", count: 11 },
|
|
16446
|
-
{ label: "Fire", count: 11 },
|
|
16447
|
-
{ label: "Slack", count: 9 },
|
|
16448
|
-
{ label: "Jira", count: 2 }
|
|
16449
|
-
]);
|
|
16450
|
-
}, 1e3);
|
|
16451
|
-
}, 300);
|
|
16452
|
-
return () => clearTimeout(timeout);
|
|
16435
|
+
onUpdate(query);
|
|
16453
16436
|
}, [query]);
|
|
16454
16437
|
const clearQuery = () => {
|
|
16455
16438
|
setQuery("");
|
|
16456
|
-
setState("inactive");
|
|
16457
16439
|
};
|
|
16458
16440
|
return /* @__PURE__ */ jsxs26("div", { className: "w-full space-y-3", children: [
|
|
16459
16441
|
/* @__PURE__ */ jsxs26("div", { className: "flex items-center px-4 py-2 rounded-full bg-gray-100 gap-2 text-gray-900", children: [
|
|
16460
|
-
|
|
16442
|
+
loading ? /* @__PURE__ */ jsx38(Loading, {}) : /* @__PURE__ */ jsx38(Search, {}),
|
|
16461
16443
|
/* @__PURE__ */ jsx38(
|
|
16462
16444
|
"input",
|
|
16463
16445
|
{
|
|
@@ -16470,7 +16452,7 @@ function SearchBar() {
|
|
|
16470
16452
|
),
|
|
16471
16453
|
query && /* @__PURE__ */ jsx38("button", { onClick: clearQuery, children: /* @__PURE__ */ jsx38(CircleX, {}) })
|
|
16472
16454
|
] }),
|
|
16473
|
-
|
|
16455
|
+
results && /* @__PURE__ */ jsxs26("div", { className: "text-sm", children: [
|
|
16474
16456
|
/* @__PURE__ */ jsxs26("p", { className: "text-gray-700 font-medium", children: [
|
|
16475
16457
|
"Search results (",
|
|
16476
16458
|
results.reduce((acc, r) => acc + r.count, 0),
|