@netlify/spark-ui 0.0.26 → 0.0.27

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.
@@ -4,27 +4,27 @@ import t from "./SearchHeading/SearchHeading.js";
4
4
  import a from "./SearchLink/SearchLink.js";
5
5
  const h = ({
6
6
  searchLoading: i,
7
- searchTerm: n,
8
- results: r
7
+ searchTerm: r,
8
+ results: n
9
9
  }) => {
10
10
  if (i)
11
11
  return /* @__PURE__ */ e(t, { children: [
12
12
  "Searching for ",
13
- /* @__PURE__ */ e("span", { className: "n-search-term", children: n }),
13
+ /* @__PURE__ */ e("span", { className: "n-search-term", children: r }),
14
14
  " ..."
15
15
  ] });
16
- if (!r || r.length === 0)
16
+ if (!n || n.length === 0)
17
17
  return /* @__PURE__ */ e(t, { children: [
18
18
  "0 results for ",
19
- /* @__PURE__ */ e("span", { className: "n-search-term", children: n })
19
+ /* @__PURE__ */ e("span", { className: "n-search-term", children: r })
20
20
  ] });
21
- const l = o(() => r.map((s, c) => /* @__PURE__ */ e("li", { className: "n-results-list-item", children: /* @__PURE__ */ e(a, { ...s }) }, c)), [r]);
21
+ const l = o(() => n.map((s, c) => /* @__PURE__ */ e("li", { className: "n-results-list-item", children: /* @__PURE__ */ e(a, { ...s }) }, c)), [n]);
22
22
  return /* @__PURE__ */ e("ul", { className: "n-results-list", role: "list", children: l });
23
23
  };
24
24
  function N({
25
25
  searchLoading: i,
26
- searchTerm: n,
27
- results: r,
26
+ searchTerm: r,
27
+ results: n,
28
28
  children: l
29
29
  }) {
30
30
  return /* @__PURE__ */ e("div", { className: "n-search-window", children: /* @__PURE__ */ e("div", { className: "search-links", children: [
@@ -33,7 +33,14 @@ function N({
33
33
  label: "Ask Netlify AI",
34
34
  url: "https://docs.netlify.com/ask-netlify/"
35
35
  } }),
36
- n ? /* @__PURE__ */ e(h, { searchLoading: i, searchTerm: n, results: r }) : l || null
36
+ r && r.length > 3 ? /* @__PURE__ */ e(
37
+ h,
38
+ {
39
+ searchLoading: i,
40
+ searchTerm: r,
41
+ results: n
42
+ }
43
+ ) : l || null
37
44
  ] }) });
38
45
  }
39
46
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "0.0.26",
4
+ "version": "0.0.27",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -131,9 +131,10 @@
131
131
  .n-search-modal {
132
132
  transition: display .2s allow-discrete, overlay .2s allow-discrete;
133
133
  animation: closeSearch .2s forwards;
134
- &[open] {
135
- animation: openSearch .2s forwards;
136
- }
134
+ }
135
+
136
+ .n-search-modal[open] {
137
+ animation: openSearch .2s forwards;
137
138
  }
138
139
 
139
140
  @keyframes openSearch {
@@ -20,9 +20,9 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({
20
20
 
21
21
  if (!results || results.length === 0) {
22
22
  return (
23
- <SearchHeading>
24
- 0 results for <span className="n-search-term">{searchTerm}</span>
25
- </SearchHeading>
23
+ <SearchHeading>
24
+ 0 results for <span className="n-search-term">{searchTerm}</span>
25
+ </SearchHeading>
26
26
  );
27
27
  }
28
28
 
@@ -58,8 +58,12 @@ export default function SearchWindow({
58
58
  <div className="n-search-window">
59
59
  <div className="search-links">
60
60
  <SearchLink {...askNetlify} />
61
- {searchTerm ? (
62
- <SearchResults searchLoading={searchLoading} searchTerm={searchTerm} results={results} />
61
+ {searchTerm && searchTerm.length > 3 ? (
62
+ <SearchResults
63
+ searchLoading={searchLoading}
64
+ searchTerm={searchTerm}
65
+ results={results}
66
+ />
63
67
  ) : DefaultWindow ? (
64
68
  DefaultWindow
65
69
  ) : null}