@netlify/spark-ui 1.12.0-alpha.0 → 1.12.0-alpha.1

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.
Files changed (60) hide show
  1. package/dist/assets/AskNetlify.css +1 -1
  2. package/dist/assets/SearchLink.css +1 -1
  3. package/dist/assets/SearchModal.css +1 -1
  4. package/dist/chunks/{ChatInterface.EQAPs01R.js → AskNetlify.lrswYyKn.js} +119 -110
  5. package/dist/components/preact/AskNetlify/AskNetlify.d.ts +3 -3
  6. package/dist/components/preact/AskNetlify/AskNetlify.js +8 -34
  7. package/dist/components/preact/AskNetlify/components/ChatMessages.d.ts +2 -1
  8. package/dist/components/preact/AskNetlify/components/ChatMessages.js +25 -21
  9. package/dist/components/preact/AskNetlify/components/SourcesList.js +17 -13
  10. package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.d.ts +23 -0
  11. package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.js +22 -0
  12. package/dist/components/preact/Icon/index.js +6 -6
  13. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.d.ts +1 -1
  14. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +23 -22
  15. package/dist/components/preact/SearchModal/components/SearchLinkThemeToggle.d.ts +1 -0
  16. package/dist/components/preact/SearchModal/components/SearchLinkThemeToggle.js +26 -0
  17. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +89 -84
  18. package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
  19. package/dist/components/preact/SearchModal/components/SearchWindow.js +55 -48
  20. package/dist/components/preact/SearchModal/hooks/index.d.ts +1 -1
  21. package/dist/components/preact/SearchModal/hooks/index.js +8 -8
  22. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.d.ts +1 -1
  23. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +11 -12
  24. package/dist/components/preact/SearchModal/hooks/useSearch.js +19 -19
  25. package/dist/components/preact/SearchModal/hooks/{useSearchLogger.d.ts → useSearchAnalytics.d.ts} +2 -2
  26. package/dist/components/preact/SearchModal/hooks/{useSearchLogger.js → useSearchAnalytics.js} +5 -5
  27. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.d.ts +1 -1
  28. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +8 -9
  29. package/dist/components/preact/SearchModal/hooks/useSearchParams.d.ts +1 -1
  30. package/dist/components/preact/SearchModal/hooks/useSearchParams.js +14 -7
  31. package/dist/components/preact/SearchModal/hooks/useSearchToggles.d.ts +1 -1
  32. package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +7 -8
  33. package/dist/components/preact/SearchModal/types/search.types.d.ts +11 -4
  34. package/dist/components/preact/index.js +3 -3
  35. package/package.json +1 -1
  36. package/packages/components/preact/AskNetlify/AskNetlify.css +41 -1
  37. package/packages/components/preact/AskNetlify/AskNetlify.tsx +98 -34
  38. package/packages/components/preact/AskNetlify/components/ChatMessages.tsx +9 -7
  39. package/packages/components/preact/AskNetlify/components/SourcesList.tsx +24 -16
  40. package/packages/components/preact/AskNetlify/hooks/useAskAnalytics.tsx +50 -0
  41. package/packages/components/preact/Icon/index.tsx +2 -2
  42. package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +5 -0
  43. package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.tsx +6 -4
  44. package/packages/components/preact/SearchModal/components/SearchLinkThemeToggle.tsx +19 -0
  45. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +22 -3
  46. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +73 -89
  47. package/packages/components/preact/SearchModal/components/SearchWindow.tsx +64 -46
  48. package/packages/components/preact/SearchModal/hooks/index.ts +1 -1
  49. package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +1 -3
  50. package/packages/components/preact/SearchModal/hooks/useSearch.ts +20 -16
  51. package/packages/components/preact/SearchModal/hooks/{useSearchLogger.ts → useSearchAnalytics.ts} +9 -10
  52. package/packages/components/preact/SearchModal/hooks/useSearchHotkeys.ts +2 -4
  53. package/packages/components/preact/SearchModal/hooks/useSearchParams.ts +24 -2
  54. package/packages/components/preact/SearchModal/hooks/useSearchToggles.ts +1 -3
  55. package/packages/components/preact/SearchModal/types/search.types.tsx +7 -4
  56. package/packages/styles/loaders.css +18 -0
  57. package/packages/styles/tokens.css +4 -0
  58. package/dist/components/preact/AskNetlify/components/ChatInterface.d.ts +0 -7
  59. package/dist/components/preact/AskNetlify/components/ChatInterface.js +0 -10
  60. package/packages/components/preact/AskNetlify/components/ChatInterface.tsx +0 -94
@@ -1,56 +1,63 @@
1
- import { u as e } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { T as o } from "../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import m from "./SearchHeading/SearchHeading.js";
4
- import a from "./SearchLink/SearchLink.js";
5
- import { Fragment as h } from "preact";
6
- const d = {
7
- light: "dark",
8
- dark: "light"
9
- }, u = (n) => {
10
- const t = document.getElementById("site-theme-select");
11
- t && (t.value = n), document.documentElement.setAttribute("data-theme", n), localStorage.setItem("theme", n);
12
- }, g = ({
13
- searchLoading: n,
14
- searchTerm: t,
15
- results: r
1
+ import { u as n } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import h from "./SearchHeading/SearchHeading.js";
3
+ import t from "./SearchLink/SearchLink.js";
4
+ import m from "./SearchLinkThemeToggle.js";
5
+ import { Fragment as r } from "preact";
6
+ const o = ({
7
+ searchTerm: i,
8
+ setModalState: l
9
+ }) => /* @__PURE__ */ n(
10
+ t,
11
+ {
12
+ as: "button",
13
+ icon: "askNetlify",
14
+ excerpt: "Get an instant AI-generated answer",
15
+ onClick: () => l({ current: "ask" }),
16
+ children: [
17
+ "Ask Netlify: ",
18
+ /* @__PURE__ */ n("span", { className: "n-search-term", children: i })
19
+ ]
20
+ }
21
+ ), f = ({ searchTerm: i }) => /* @__PURE__ */ n("div", { className: "n-search-feedback", children: /* @__PURE__ */ n("p", { className: "n-results-info", children: [
22
+ "0 results for ",
23
+ /* @__PURE__ */ n("span", { className: "n-search-term", children: i })
24
+ ] }) }), N = ({
25
+ setModalState: i,
26
+ searchLoading: l,
27
+ searchTerm: e,
28
+ results: s
16
29
  }) => {
17
- if (n)
18
- return /* @__PURE__ */ e(m, { children: [
19
- "Searching for ",
20
- /* @__PURE__ */ e("span", { className: "n-search-term", children: t }),
21
- " ..."
22
- ] });
23
- if (!r || r.length === 0)
24
- return /* @__PURE__ */ e(m, { children: [
25
- "0 results for ",
26
- /* @__PURE__ */ e("span", { className: "n-search-term", children: t })
27
- ] });
28
- const c = o(() => r.map((i, l) => /* @__PURE__ */ e("li", { className: "n-results-list-item", children: /* @__PURE__ */ e(a, { ...i }) }, l)), [r]);
29
- return /* @__PURE__ */ e("ul", { className: "n-results-list", role: "list", children: c });
30
+ const c = e === "no results" || !l && (!s || s.length === 0);
31
+ return /* @__PURE__ */ n(r, { children: [
32
+ /* @__PURE__ */ n(o, { searchTerm: e, setModalState: i }),
33
+ c ? /* @__PURE__ */ n(f, { searchTerm: e }) : /* @__PURE__ */ n("ul", { className: "n-results-list", role: "list", children: s == null ? void 0 : s.map((a, d) => /* @__PURE__ */ n("li", { className: "n-results-list-item", children: /* @__PURE__ */ n(t, { ...a }) }, d)) })
34
+ ] });
30
35
  };
31
- function N({
32
- searchLoading: n,
33
- searchTerm: t,
34
- results: r,
36
+ function w({
37
+ setModalState: i,
38
+ searchLoading: l,
39
+ searchTerm: e,
40
+ results: s,
35
41
  children: c
36
42
  }) {
37
- return /* @__PURE__ */ e("div", { className: "n-search-window", children: /* @__PURE__ */ e("div", { className: "n-search-links", children: t && t.length > 1 ? /* @__PURE__ */ e(g, { searchLoading: n, searchTerm: t, results: r }) : c ? /* @__PURE__ */ e(h, { children: [
43
+ const a = (e == null ? void 0 : e.length) > 1;
44
+ return /* @__PURE__ */ n("div", { className: "n-search-window", children: /* @__PURE__ */ n("div", { className: "n-search-links", children: a ? l ? /* @__PURE__ */ n(r, { children: [
45
+ /* @__PURE__ */ n(o, { searchTerm: e, setModalState: i }),
46
+ /* @__PURE__ */ n("div", { className: "n-search-feedback", children: /* @__PURE__ */ n("div", { className: "n-loader-dots-spinner" }) })
47
+ ] }) : /* @__PURE__ */ n(
48
+ N,
49
+ {
50
+ setModalState: i,
51
+ searchLoading: l,
52
+ searchTerm: e,
53
+ results: s
54
+ }
55
+ ) : /* @__PURE__ */ n(r, { children: [
38
56
  c,
39
- /* @__PURE__ */ e(m, { children: "Actions" }),
40
- /* @__PURE__ */ e(
41
- a,
42
- {
43
- as: "button",
44
- icon: "lightbulb",
45
- label: "Toggle theme",
46
- onClick: () => {
47
- const i = window.matchMedia("(prefers-color-scheme: dark)").matches, l = document.documentElement.getAttribute("data-theme"), s = i ? "dark" : l || "light";
48
- s && u(d[s]);
49
- }
50
- }
51
- )
52
- ] }) : null }) });
57
+ /* @__PURE__ */ n(h, { children: "Actions" }),
58
+ /* @__PURE__ */ n(m, {})
59
+ ] }) }) });
53
60
  }
54
61
  export {
55
- N as default
62
+ w as default
56
63
  };
@@ -1,5 +1,5 @@
1
1
  export { useSearch } from '../hooks/useSearch';
2
- export { useSearchLogger } from './useSearchLogger';
2
+ export { useSearchAnalytics } from './useSearchAnalytics';
3
3
  export { useKeyboardNav } from '../hooks/useKeyboardNav';
4
4
  export { useSearchHotkeys } from '../hooks/useSearchHotkeys';
5
5
  export { useSearchParams } from '../hooks/useSearchParams';
@@ -1,14 +1,14 @@
1
1
  import { useSearch as o } from "./useSearch.js";
2
- import { useSearchLogger as s } from "./useSearchLogger.js";
3
- import { useKeyboardNav as t } from "./useKeyboardNav.js";
4
- import { useSearchHotkeys as p } from "./useSearchHotkeys.js";
5
- import { useSearchParams as x } from "./useSearchParams.js";
2
+ import { useSearchAnalytics as s } from "./useSearchAnalytics.js";
3
+ import { useKeyboardNav as m } from "./useKeyboardNav.js";
4
+ import { useSearchHotkeys as f } from "./useSearchHotkeys.js";
5
+ import { useSearchParams as u } from "./useSearchParams.js";
6
6
  import { useSearchToggles as h } from "./useSearchToggles.js";
7
7
  export {
8
- t as useKeyboardNav,
8
+ m as useKeyboardNav,
9
9
  o as useSearch,
10
- p as useSearchHotkeys,
11
- s as useSearchLogger,
12
- x as useSearchParams,
10
+ s as useSearchAnalytics,
11
+ f as useSearchHotkeys,
12
+ u as useSearchParams,
13
13
  h as useSearchToggles
14
14
  };
@@ -11,4 +11,4 @@ import { RefObject } from 'preact';
11
11
  * @param isOpen - Boolean indicating whether the navigation context is active
12
12
  * @param onClose - Callback to close the navigation UI when `Escape` is pressed
13
13
  */
14
- export declare function useKeyboardNav(isPagefindLoaded: boolean, containerRef: RefObject<HTMLElement>, isOpen: boolean, onClose: () => void): void;
14
+ export declare function useKeyboardNav(containerRef: RefObject<HTMLElement>, isOpen: boolean, onClose: () => void): void;
@@ -1,25 +1,24 @@
1
- import { y as f } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- function k(r, t, o, c) {
3
- f(() => {
4
- if (!r) return;
5
- const u = (e) => {
6
- if (o) {
1
+ import { y as l } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ function a(r, t, o) {
3
+ l(() => {
4
+ const c = (e) => {
5
+ if (t) {
7
6
  if (e.key === "Escape") {
8
- c();
7
+ o();
9
8
  return;
10
9
  }
11
10
  if (e.key === "ArrowUp" || e.key === "ArrowDown") {
12
11
  e.preventDefault();
13
- const d = t.current;
12
+ const d = r.current;
14
13
  if (!d) return;
15
- const n = Array.from(d.querySelectorAll(".n-search-link")), y = n.findIndex((l) => l === document.activeElement), i = e.key === "ArrowDown" ? (y + 1) % n.length : (y - 1 + n.length) % n.length;
14
+ const n = Array.from(d.querySelectorAll(".n-search-link")), u = n.findIndex((y) => y === document.activeElement), i = e.key === "ArrowDown" ? (u + 1) % n.length : (u - 1 + n.length) % n.length;
16
15
  n[i].focus();
17
16
  }
18
17
  }
19
18
  };
20
- return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
21
- }, [r, t, o, c]);
19
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
20
+ }, [r, t, o]);
22
21
  }
23
22
  export {
24
- k as useKeyboardNav
23
+ a as useKeyboardNav
25
24
  };
@@ -1,47 +1,47 @@
1
- import { d as g, A as w } from "../../../../chunks/hooks.module.DGkdD5n9.js";
1
+ import { d as p, A as w } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
2
  import { u as S } from "../../../../chunks/useTimeout.Cq4aqnDe.js";
3
3
  function x() {
4
- const [l, r] = g({
4
+ const [d, s] = p({
5
5
  searchTerm: "",
6
6
  results: [],
7
7
  isLoading: !1
8
- }), n = w(/* @__PURE__ */ new Map()), { reset: d, run: h } = S((e) => {
9
- c(e);
8
+ }), n = w(/* @__PURE__ */ new Map()), { reset: h, run: m } = S((e) => {
9
+ e && e.length >= 2 && c(e);
10
10
  }, 150), c = async (e) => {
11
- var i;
11
+ var o;
12
12
  if (!(window != null && window.pagefind)) return;
13
- if (r((a) => ({ ...a, isLoading: !0 })), n.current.has(e)) {
14
- r((a) => ({
13
+ if (s((a) => ({ ...a, isLoading: !0 })), n.current.has(e)) {
14
+ s((a) => ({
15
15
  ...a,
16
16
  results: n.current.get(e),
17
17
  isLoading: !1
18
18
  }));
19
19
  return;
20
20
  }
21
- const t = await window.pagefind.debouncedSearch(e), m = (t == null ? void 0 : t.results) && await Promise.all(
22
- (i = t == null ? void 0 : t.results) == null ? void 0 : i.slice(0, 15).map(async (a) => {
23
- var o, u;
24
- const s = await a.data(), f = (p) => p.replace("#", "");
21
+ const t = await window.pagefind.debouncedSearch(e), i = (t == null ? void 0 : t.results) && await Promise.all(
22
+ (o = t == null ? void 0 : t.results) == null ? void 0 : o.slice(0, 15).map(async (a) => {
23
+ var l, u;
24
+ const r = await a.data(), f = (g) => g.replace("#", "");
25
25
  return {
26
26
  icon: "pageWithLines",
27
- resource: (o = s.meta) == null ? void 0 : o.resource,
28
- label: (u = s.meta) == null ? void 0 : u.title,
29
- url: s.url,
30
- excerpt: f(s.excerpt)
27
+ resource: (l = r.meta) == null ? void 0 : l.resource,
28
+ label: (u = r.meta) == null ? void 0 : u.title,
29
+ url: r.url,
30
+ excerpt: f(r.excerpt)
31
31
  };
32
32
  })
33
33
  );
34
- r((a) => ({
34
+ n.current.set(e, i), s((a) => ({
35
35
  ...a,
36
- results: m,
36
+ results: i,
37
37
  isLoading: !1
38
38
  }));
39
39
  };
40
40
  return {
41
- state: l,
41
+ state: d,
42
42
  actions: {
43
43
  setSearchTerm: (e) => {
44
- r((t) => ({ ...t, searchTerm: e })), d(), h(e);
44
+ s((t) => ({ ...t, results: [], searchTerm: e })), h(), m(e);
45
45
  },
46
46
  submitSearch: c
47
47
  }
@@ -18,11 +18,11 @@ import { SearchState } from '../types/search.types';
18
18
  * - `handleClick`: A callback function that should be attached to search result click events. It tracks `search:result_selected` events with the clicked result's title and URL.
19
19
  *
20
20
  * @example
21
- * const { handleClick } = useSearchLogger(searchState);
21
+ * const { handleClick } = useSearchAnalytics(searchState);
22
22
  *
23
23
  * // In your component, attach handleClick to the search result links
24
24
  * <a href="result-url" onClick={handleClick}>Search Result</a>
25
25
  */
26
- export declare function useSearchLogger(state?: SearchState, debug?: boolean): {
26
+ export declare function useSearchAnalytics(state?: SearchState, debug?: boolean): {
27
27
  handleClick: (e: Event) => void;
28
28
  };
@@ -1,9 +1,9 @@
1
1
  import { A as y, y as h, q as d } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- import { A as k } from "../../../../chunks/analytics.Ch1vuuOl.js";
3
- function b(r, l) {
4
- const n = y(new k()).current, e = (c) => c.debug_mode = !0;
2
+ import { A as T } from "../../../../chunks/analytics.Ch1vuuOl.js";
3
+ function A(r, l) {
4
+ const n = y(new T()).current, e = (c) => c.debug_mode = !0;
5
5
  return h(() => {
6
- if (!(r != null && r.searchTerm)) return;
6
+ if (!(r != null && r.searchTerm) || (r == null ? void 0 : r.searchTerm.length) < 3) return;
7
7
  const c = { query: r == null ? void 0 : r.searchTerm };
8
8
  l && e(c), n.track("search:new_query", c);
9
9
  }, [r == null ? void 0 : r.searchTerm]), h(() => {
@@ -24,5 +24,5 @@ function b(r, l) {
24
24
  };
25
25
  }
26
26
  export {
27
- b as useSearchLogger
27
+ A as useSearchAnalytics
28
28
  };
@@ -10,4 +10,4 @@
10
10
  * @param onOpen - Callback to open the search interface.
11
11
  * @param onClose - Callback to close the search interface.
12
12
  */
13
- export declare function useSearchHotkeys(isPagefindLoaded: boolean, isOpen: boolean, onOpen: () => void, onClose: () => void): void;
13
+ export declare function useSearchHotkeys(isOpen: boolean, onOpen: () => void, onClose: () => void): void;
@@ -1,13 +1,12 @@
1
- import { y as u } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- function a(t, r, n, o) {
3
- u(() => {
4
- if (!t) return;
5
- const m = (e) => {
6
- e.metaKey && e.key === "k" && (e.preventDefault(), e.stopImmediatePropagation(), r ? o() : n());
1
+ import { y as d } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ function m(t, n, o) {
3
+ d(() => {
4
+ const r = (e) => {
5
+ e.metaKey && e.key === "k" && (e.preventDefault(), e.stopImmediatePropagation(), t ? o() : n());
7
6
  };
8
- return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
9
- }, [t, r, n, o]);
7
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
8
+ }, [t, n, o]);
10
9
  }
11
10
  export {
12
- a as useSearchHotkeys
11
+ m as useSearchHotkeys
13
12
  };
@@ -8,4 +8,4 @@
8
8
  * @param setSearchTerm - Function to update the search input state.
9
9
  * @param onOpen - Function to trigger opening of the search interface (e.g., modal or drawer).
10
10
  */
11
- export declare function useSearchParams(isPagefindLoaded: boolean, setSearchTerm: (term: string) => void, onOpen: () => void): void;
11
+ export declare function useSearchParams(setSearchTerm: (term: string) => void, onOpen: () => void): void;
@@ -1,11 +1,18 @@
1
- import { y as c } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- function n(r, o, a) {
3
- c(() => {
4
- if (typeof location > "u" || r) return;
1
+ import { d as c, y as n } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ function d(t, o) {
3
+ const [a, i] = c(!1);
4
+ n(() => {
5
+ let e;
6
+ const r = () => {
7
+ window.pagefind && (i(!0), e && clearInterval(e));
8
+ };
9
+ return r(), e = setInterval(r, 100), () => clearInterval(e);
10
+ }, []), n(() => {
11
+ if (typeof location > "u" || a) return;
5
12
  const e = (location == null ? void 0 : location.search) && new URLSearchParams(location.search).get("search");
6
- e && (o(e), a());
7
- }, [r]);
13
+ e && (t(e), o());
14
+ }, [a]);
8
15
  }
9
16
  export {
10
- n as useSearchParams
17
+ d as useSearchParams
11
18
  };
@@ -9,6 +9,6 @@
9
9
  *
10
10
  * @param onOpen - A function to be called when a toggle element is clicked.
11
11
  */
12
- export declare function useSearchToggles(isPagefindLoaded: boolean, onOpen: () => void, setState: (state: {
12
+ export declare function useSearchToggles(onOpen: () => void, setState: (state: {
13
13
  current: string;
14
14
  }) => void): void;
@@ -1,19 +1,18 @@
1
- import { y as a } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- function s(c, t, l) {
3
- a(() => {
4
- if (!c) return;
1
+ import { y as l } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ function n(t, c) {
3
+ l(() => {
5
4
  const r = document.querySelectorAll("[data-ntl-search-toggle]");
6
5
  if (r.length)
7
6
  return r.forEach((e) => {
8
- const o = e.dataset.ntlSearchToggle ? e.dataset.ntlSearchToggle : "search";
7
+ const a = e.dataset.ntlSearchToggle ? e.dataset.ntlSearchToggle : "search";
9
8
  e.removeAttribute("disabled"), e.addEventListener("click", () => {
10
- t(), l({ current: o });
9
+ t(), c({ current: a });
11
10
  });
12
11
  }), () => {
13
12
  r.forEach((e) => e.removeEventListener("click", t));
14
13
  };
15
- }, [c, t]);
14
+ }, [t]);
16
15
  }
17
16
  export {
18
- s as useSearchToggles
17
+ n as useSearchToggles
19
18
  };
@@ -2,22 +2,29 @@ import { ComponentChildren } from 'preact';
2
2
  import { IconName } from '../../Icon';
3
3
  export interface SearchLinkProps {
4
4
  as?: any;
5
- icon: IconName;
6
- label: string;
5
+ icon?: IconName;
6
+ label?: string;
7
7
  resource?: 'blog' | 'changelog' | 'docs' | 'guide';
8
8
  url?: string;
9
9
  excerpt?: string;
10
+ children?: ComponentChildren;
10
11
  onClick?: () => void;
11
12
  }
12
13
  export interface SearchWindowProps {
14
+ setModalState: (e: {
15
+ current: string;
16
+ }) => void;
13
17
  searchLoading: boolean;
14
- searchTerm?: string;
18
+ searchTerm: string;
15
19
  results?: SearchLinkProps[];
16
20
  children: ComponentChildren;
17
21
  }
18
22
  export interface SearchResultsProps {
23
+ setModalState: (e: {
24
+ current: string;
25
+ }) => void;
19
26
  searchLoading: boolean;
20
- searchTerm?: string;
27
+ searchTerm: string;
21
28
  results?: SearchLinkProps[];
22
29
  }
23
30
  export interface SearchState {
@@ -2,9 +2,9 @@ import { default as t } from "./KeyboardKey/KeyboardKey.js";
2
2
  import { default as d } from "./Modal/Modal.js";
3
3
  import { default as m } from "./Icon/index.js";
4
4
  import { default as s } from "./SearchModal/components/SearchLink/SearchLink.js";
5
- import { default as x } from "./SearchModal/components/SearchHeading/SearchHeading.js";
5
+ import { default as u } from "./SearchModal/components/SearchHeading/SearchHeading.js";
6
6
  import { default as i } from "./SearchModal/components/SearchToggle/SearchToggle.js";
7
- import { default as S } from "./AskNetlify/AskNetlify.js";
7
+ import { A as S } from "../../chunks/AskNetlify.lrswYyKn.js";
8
8
  import "preact";
9
9
  import "../../chunks/hooks.module.DGkdD5n9.js";
10
10
  import { default as n } from "./SearchModal/components/SearchModal/SearchModal.js";
@@ -13,7 +13,7 @@ export {
13
13
  m as Icon,
14
14
  t as KeyboardKey,
15
15
  d as Modal,
16
- x as SearchHeading,
16
+ u as SearchHeading,
17
17
  s as SearchLink,
18
18
  n as SearchModal,
19
19
  i as SearchToggle
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": "1.12.0-alpha.0",
4
+ "version": "1.12.0-alpha.1",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -12,11 +12,12 @@
12
12
  .n-ask-conversation {
13
13
  display: grid;
14
14
  align-items: flex-end;
15
+ gap: var(--space-s);
15
16
  height: calc(var(--n-search-container-height) + var(--n-search-footer-height));
16
17
  padding: var(--n-search-padding-inline);
17
18
  overflow-y: auto;
18
19
  scroll-behavior: smooth;
19
- gap: var(--space-s);
20
+ grid-template-rows: 1fr;
20
21
  }
21
22
 
22
23
  .n-ask-form {
@@ -84,6 +85,9 @@
84
85
  display: grid;
85
86
  grid-template-columns: minmax(0, 1fr);
86
87
  gap: var(--space-s);
88
+ }
89
+
90
+ .n-ask-message:first-of-type {
87
91
  margin-block-start: var(--space-2xl);
88
92
  }
89
93
 
@@ -114,6 +118,41 @@
114
118
  font-size: var(--step--1);
115
119
  }
116
120
 
121
+ .n-ask-sources details summary::marker {
122
+ display: none;
123
+ content: none;
124
+ }
125
+
126
+ .n-ask-sources details {
127
+ background: var(--search-source-list-color);
128
+ padding: var(--space-xs) var(--space-xs);
129
+ border-radius: var(--radius-l);
130
+ }
131
+
132
+ .n-ask-sources details summary {
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: space-between;
136
+ gap: var(--space-xs);
137
+ cursor: pointer;
138
+ }
139
+
140
+ .n-ask-sources details ul {
141
+ margin-block-start: var(--space-3xs);
142
+ }
143
+
144
+ .n-ask-sources [data-icon='caretRight'] {
145
+ width: 0.8em;
146
+ display: inline-block;
147
+ transform: rotate(90deg);
148
+ height: auto;
149
+ color: var(--color-text-weaker);
150
+ }
151
+
152
+ .n-ask-sources details[open] [data-icon='caretRight'] {
153
+ transform: rotate(270deg);
154
+ }
155
+
117
156
  /* ----------------------------- */
118
157
  /* Form UI */
119
158
  /* ----------------------------- */
@@ -248,6 +287,7 @@
248
287
  }
249
288
 
250
289
  .n-ask-message-loader :where(#ask-netlify-eyelid-left, #ask-netlify-eyelid-right) {
290
+ --n-ask-netlify-eyelid-color: var(--search-bg-color);
251
291
  transform-origin: top center;
252
292
  transform: scaleY(1.035);
253
293
  animation: askEyeBlink 4s infinite;