@netlify/spark-ui 1.0.2 → 1.0.3-alpha.0

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 (45) hide show
  1. package/dist/assets/AskNetlify.css +1 -0
  2. package/dist/assets/Orb.css +1 -0
  3. package/dist/assets/SearchLink.css +1 -1
  4. package/dist/assets/SearchModal.css +1 -1
  5. package/dist/chunks/compat.module.BjTzMHXJ.js +296 -0
  6. package/dist/chunks/hooks.module.DeYLzLnU.js +177 -0
  7. package/dist/chunks/{useTimeout.DOkYFG64.js → useTimeout.DYuvQwFN.js} +1 -1
  8. package/dist/components/index.d.ts +1 -0
  9. package/dist/components/preact/AskNetlify/AskNetlify.d.ts +2 -0
  10. package/dist/components/preact/AskNetlify/AskNetlify.js +5288 -0
  11. package/dist/components/preact/Modal/Modal.js +1 -1
  12. package/dist/components/preact/Orb/Orb.d.ts +2 -0
  13. package/dist/components/preact/Orb/Orb.js +5 -0
  14. package/dist/components/preact/SearchModal/components/SearchInput.d.ts +2 -0
  15. package/dist/components/preact/SearchModal/components/SearchInput.js +2 -2
  16. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +1 -1
  17. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +81 -51
  18. package/dist/components/preact/SearchModal/components/SearchToggle/SearchToggle.js +1 -1
  19. package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
  20. package/dist/components/preact/SearchModal/components/SearchWindow.js +39 -34
  21. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +6 -6
  22. package/dist/components/preact/SearchModal/hooks/useSearch.js +2 -2
  23. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +1 -1
  24. package/dist/components/preact/SearchModal/hooks/useSearchLogger.js +1 -1
  25. package/dist/components/preact/SearchModal/hooks/useSearchParams.js +1 -1
  26. package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +1 -1
  27. package/dist/components/preact/SearchModal/types/search.types.d.ts +3 -0
  28. package/dist/components/preact/index.d.ts +1 -0
  29. package/dist/components/preact/index.js +7 -5
  30. package/package.json +4 -2
  31. package/packages/components/index.ts +1 -0
  32. package/packages/components/preact/AskNetlify/AskNetlify.css +161 -0
  33. package/packages/components/preact/AskNetlify/AskNetlify.tsx +119 -0
  34. package/packages/components/preact/Orb/Orb.css +94 -0
  35. package/packages/components/preact/Orb/Orb.tsx +7 -0
  36. package/packages/components/preact/SearchModal/components/SearchInput.tsx +9 -7
  37. package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +6 -1
  38. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +67 -11
  39. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +67 -30
  40. package/packages/components/preact/SearchModal/components/SearchWindow.tsx +27 -16
  41. package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +2 -2
  42. package/packages/components/preact/SearchModal/types/search.types.tsx +2 -1
  43. package/packages/components/preact/index.ts +1 -0
  44. package/dist/chunks/compat.module.DT16W4Wr.js +0 -175
  45. package/dist/chunks/hooks.module.CNV9mxng.js +0 -138
@@ -1,5 +1,5 @@
1
1
  import { u as l } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { D as d } from "../../../chunks/compat.module.DT16W4Wr.js";
2
+ import { D as d } from "../../../chunks/compat.module.BjTzMHXJ.js";
3
3
  const u = d(function({ children: o, className: r, ...a }, t) {
4
4
  return /* @__PURE__ */ l("dialog", { ref: t, className: r, role: "dialog", "aria-modal": "true", ...a, children: o });
5
5
  });
@@ -0,0 +1,2 @@
1
+ declare const Orb: () => import("preact").JSX.Element;
2
+ export default Orb;
@@ -0,0 +1,5 @@
1
+ import { u as r } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import '../../../assets/Orb.css';const t = () => /* @__PURE__ */ r("div", { class: "orb" });
3
+ export {
4
+ t as default
5
+ };
@@ -2,6 +2,8 @@ interface Props {
2
2
  setSearchTerm: (term: string) => void;
3
3
  placeholder?: string;
4
4
  initialValue?: string;
5
+ isGeneratingAnswer?: boolean;
6
+ isPreparingAnswer?: boolean;
5
7
  }
6
8
  declare const SearchInput: (props: Props) => import("preact").JSX.Element;
7
9
  export default SearchInput;
@@ -1,6 +1,6 @@
1
1
  import { u as e } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { d as u, y as h } from "../../../../chunks/hooks.module.CNV9mxng.js";
3
- import { u as o } from "../../../../chunks/useTimeout.DOkYFG64.js";
2
+ import { d as u, y as h } from "../../../../chunks/hooks.module.DeYLzLnU.js";
3
+ import { u as o } from "../../../../chunks/useTimeout.DYuvQwFN.js";
4
4
  import d from "../../Icon/index.js";
5
5
  const I = (a) => {
6
6
  const [r, t] = u(""), { reset: c, run: i } = o((l) => {
@@ -1,5 +1,5 @@
1
1
  import { u as a } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import "../../../../../chunks/hooks.module.CNV9mxng.js";
2
+ import "../../../../../chunks/hooks.module.DeYLzLnU.js";
3
3
  import { useSearchLogger as h } from "../../hooks/useSearchLogger.js";
4
4
  import c from "../../../Icon/index.js";
5
5
  import '../../../../../assets/SearchLink.css';const k = ({ icon: n, label: s, url: r, excerpt: l, resource: e }) => {
@@ -1,63 +1,93 @@
1
1
  import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { A as v, y as u, d as S } from "../../../../../chunks/hooks.module.CNV9mxng.js";
3
- import L from "../../../Modal/Modal.js";
4
- import d from "../../../KeyboardKey/KeyboardKey.js";
5
- import k from "../SearchWindow.js";
6
- import w from "../SearchInput.js";
7
- import { useSearch as I } from "../../hooks/useSearch.js";
8
- import { useSearchLogger as b } from "../../hooks/useSearchLogger.js";
9
- import { useKeyboardNav as O } from "../../hooks/useKeyboardNav.js";
10
- import { useSearchHotkeys as P } from "../../hooks/useSearchHotkeys.js";
11
- import { useSearchParams as E } from "../../hooks/useSearchParams.js";
12
- import { useSearchToggles as K } from "../../hooks/useSearchToggles.js";
13
- import '../../../../../assets/SearchModal.css';function M(o) {
14
- const r = v(null);
2
+ import { A as N, y as u, d as m } from "../../../../../chunks/hooks.module.DeYLzLnU.js";
3
+ import b from "../../../Modal/Modal.js";
4
+ import h from "../../../KeyboardKey/KeyboardKey.js";
5
+ import M from "../SearchWindow.js";
6
+ import O from "../SearchInput.js";
7
+ import { useSearch as P } from "../../hooks/useSearch.js";
8
+ import { useSearchLogger as A } from "../../hooks/useSearchLogger.js";
9
+ import { useKeyboardNav as E } from "../../hooks/useKeyboardNav.js";
10
+ import { useSearchHotkeys as K } from "../../hooks/useSearchHotkeys.js";
11
+ import { useSearchParams as q } from "../../hooks/useSearchParams.js";
12
+ import { useSearchToggles as C } from "../../hooks/useSearchToggles.js";
13
+ import F from "../../../AskNetlify/AskNetlify.js";
14
+ import { Fragment as Q } from "preact";
15
+ import '../../../../../assets/SearchModal.css';function R(c) {
16
+ const r = N(null);
15
17
  return u(() => {
16
- function t(i) {
17
- r.current && !r.current.contains(i.target) && o();
18
+ function i(t) {
19
+ r.current && !r.current.contains(t.target) && c();
18
20
  }
19
- return document.addEventListener("mousedown", t), () => {
20
- document.removeEventListener("mousedown", t);
21
+ return document.addEventListener("mousedown", i), () => {
22
+ document.removeEventListener("mousedown", i);
21
23
  };
22
- }, [o]), r;
24
+ }, [c]), r;
23
25
  }
24
- function B(o = { className: "", children: null, debug: !1 }) {
25
- const [r, t] = S(!1);
26
+ function Z(c = { className: "", children: null, debug: !1 }) {
27
+ const [r, i] = m(!1), [t, p] = m({ current: "search" }), [k, v] = m("");
26
28
  u(() => {
27
- let c;
28
- const g = () => {
29
- window.pagefind && (t(!0), c && clearInterval(c));
29
+ let a;
30
+ const o = () => {
31
+ window.pagefind && (i(!0), a && clearInterval(a));
30
32
  };
31
- return g(), c = setInterval(g, 100), () => clearInterval(c);
33
+ return o(), a = setInterval(o, 100), () => clearInterval(a);
32
34
  }, []);
33
- const { children: i, className: f, debug: N, ...y } = o, { state: a, actions: h } = I(), [n, p] = S(!1), m = () => p(!0), l = () => p(!1), s = v(null), T = M(l);
34
- return b(a, N), K(r, m), E(r, h.setSearchTerm, m), P(r, n, m, l), O(r, s, n, l), u(() => {
35
- s.current && (n ? s.current.showModal() : s.current.close());
36
- }, [n]), /* @__PURE__ */ e(L, { ref: s, className: `n-search-modal ${f || ""}`, ...y, children: /* @__PURE__ */ e("div", { ref: T, className: "n-search-container", children: [
37
- /* @__PURE__ */ e(w, { setSearchTerm: h.setSearchTerm, initialValue: a.searchTerm }),
38
- /* @__PURE__ */ e(
39
- k,
40
- {
41
- searchLoading: a.isLoading,
42
- searchTerm: a.searchTerm,
43
- results: a.results,
44
- children: i
45
- }
46
- ),
47
- /* @__PURE__ */ e("div", { className: "n-search-footer", children: [
48
- /* @__PURE__ */ e("p", { className: "n-search-footer-tip", children: [
49
- /* @__PURE__ */ e(d, { keyNames: ["Esc"] }),
50
- "to close"
51
- ] }),
52
- /* @__PURE__ */ e("p", { className: "n-search-footer-tip", children: [
53
- /* @__PURE__ */ e(d, { keyNames: ["Tab"] }),
54
- /* @__PURE__ */ e("span", { children: "or" }),
55
- /* @__PURE__ */ e(d, { keyNames: ["↑", "↓"] }),
56
- "to navigate"
35
+ const { children: T, className: S, debug: L, ...w } = c, { state: n, actions: g } = P(), [l, y] = m(!1), d = () => y(!0), f = () => y(!1), s = N(null), I = R(f);
36
+ return A(n, L), C(r, d), q(r, g.setSearchTerm, d), K(r, l, d, f), E(r, s, l, f), u(() => {
37
+ s.current && (l ? s.current.showModal() : s.current.close());
38
+ }, [l]), u(() => {
39
+ var o;
40
+ const a = (o = s.current) == null ? void 0 : o.querySelector("input");
41
+ a && a.focus(), t.current === "ask" ? setTimeout(() => {
42
+ s.current.classList.add("n-search-modal-ask");
43
+ }, 150) : t.current === "search" && setTimeout(() => {
44
+ s.current.classList.remove("n-search-modal-ask");
45
+ }, 150);
46
+ }, [t.current]), /* @__PURE__ */ e(
47
+ b,
48
+ {
49
+ ref: s,
50
+ className: `n-search-modal ${S || ""}`,
51
+ "data-state": t.current,
52
+ ...w,
53
+ children: /* @__PURE__ */ e("div", { ref: I, className: "n-search-container", children: [
54
+ t.current === "ask" && /* @__PURE__ */ e(F, { query: k, setModalState: p }),
55
+ t.current === "search" && /* @__PURE__ */ e(Q, { children: [
56
+ /* @__PURE__ */ e(
57
+ O,
58
+ {
59
+ setSearchTerm: g.setSearchTerm,
60
+ setAskNetlifyQuery: v,
61
+ initialValue: n.searchTerm
62
+ }
63
+ ),
64
+ /* @__PURE__ */ e(
65
+ M,
66
+ {
67
+ setModalState: p,
68
+ searchLoading: n.isLoading,
69
+ searchTerm: n.searchTerm,
70
+ results: n.results,
71
+ children: T
72
+ }
73
+ ),
74
+ /* @__PURE__ */ e("div", { className: "n-search-footer", children: [
75
+ /* @__PURE__ */ e("p", { className: "n-search-footer-tip", children: [
76
+ /* @__PURE__ */ e(h, { keyNames: ["Esc"] }),
77
+ "to closed"
78
+ ] }),
79
+ /* @__PURE__ */ e("p", { className: "n-search-footer-tip", children: [
80
+ /* @__PURE__ */ e(h, { keyNames: ["Tab"] }),
81
+ /* @__PURE__ */ e("span", { children: "or" }),
82
+ /* @__PURE__ */ e(h, { keyNames: ["↑", "↓"] }),
83
+ "to navigate"
84
+ ] })
85
+ ] })
86
+ ] })
57
87
  ] })
58
- ] })
59
- ] }) });
88
+ }
89
+ );
60
90
  }
61
91
  export {
62
- B as default
92
+ Z as default
63
93
  };
@@ -1,5 +1,5 @@
1
1
  import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { D as a } from "../../../../../chunks/compat.module.DT16W4Wr.js";
2
+ import { D as a } from "../../../../../chunks/compat.module.BjTzMHXJ.js";
3
3
  import o from "../../../Icon/index.js";
4
4
  import '../../../../../assets/SearchToggle.css';const s = a(function(r, t) {
5
5
  return /* @__PURE__ */ e("button", { id: r.id, ref: t, class: "n-search-toggle button", disabled: !0, "data-ntl-search-toggle": !0, children: [
@@ -1,2 +1,2 @@
1
1
  import { SearchWindowProps } from '../types/search.types';
2
- export default function SearchWindow({ searchLoading, searchTerm, results, children: DefaultWindow, }: SearchWindowProps): import("preact").JSX.Element;
2
+ export default function SearchWindow({ setModalState, searchLoading, searchTerm, results, children: DefaultWindow, }: SearchWindowProps): import("preact").JSX.Element;
@@ -1,48 +1,53 @@
1
- import { u as e } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { T as o } from "../../../../chunks/hooks.module.CNV9mxng.js";
3
- import t from "./SearchHeading/SearchHeading.js";
4
- import a from "./SearchLink/SearchLink.js";
5
- const h = ({
6
- searchLoading: s,
1
+ import { u as n } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import { T as h } from "../../../../chunks/hooks.module.DeYLzLnU.js";
3
+ import s from "./SearchHeading/SearchHeading.js";
4
+ import m from "./SearchLink/SearchLink.js";
5
+ import a from "../../Icon/index.js";
6
+ import { Fragment as o } from "preact";
7
+ const d = ({
8
+ searchLoading: l,
7
9
  searchTerm: r,
8
- results: n
10
+ results: e
9
11
  }) => {
10
- if (s)
11
- return /* @__PURE__ */ e(t, { children: [
12
+ if (l)
13
+ return /* @__PURE__ */ n(s, { children: [
12
14
  "Searching for ",
13
- /* @__PURE__ */ e("span", { className: "n-search-term", children: r }),
15
+ /* @__PURE__ */ n("span", { className: "n-search-term", children: r }),
14
16
  " ..."
15
17
  ] });
16
- if (!n || n.length === 0)
17
- return /* @__PURE__ */ e(t, { children: [
18
+ if (!e || e.length === 0)
19
+ return /* @__PURE__ */ n(s, { children: [
18
20
  "0 results for ",
19
- /* @__PURE__ */ e("span", { className: "n-search-term", children: r })
21
+ /* @__PURE__ */ n("span", { className: "n-search-term", children: r })
20
22
  ] });
21
- const l = o(() => n.map((i, c) => /* @__PURE__ */ e("li", { className: "n-results-list-item", children: /* @__PURE__ */ e(a, { ...i }) }, c)), [n]);
22
- return /* @__PURE__ */ e("ul", { className: "n-results-list", role: "list", children: l });
23
+ const c = h(() => e.map((i, t) => /* @__PURE__ */ n("li", { className: "n-results-list-item", children: /* @__PURE__ */ n(m, { ...i }) }, t)), [e]);
24
+ return /* @__PURE__ */ n("ul", { className: "n-results-list", role: "list", children: c });
23
25
  };
24
- function p({
25
- searchLoading: s,
26
- searchTerm: r,
27
- results: n,
28
- children: l
26
+ function S({
27
+ setModalState: l,
28
+ searchLoading: r,
29
+ searchTerm: e,
30
+ results: c,
31
+ children: i
29
32
  }) {
30
- return /* @__PURE__ */ e("div", { className: "n-search-window", children: /* @__PURE__ */ e("div", { className: "search-links", children: [
31
- /* @__PURE__ */ e(a, { ...{
32
- icon: "sparkles",
33
- label: "Ask Netlify AI",
34
- url: "https://docs.netlify.com/ask-netlify/"
35
- } }),
36
- r && r.length > 1 ? /* @__PURE__ */ e(
37
- h,
33
+ return /* @__PURE__ */ n("div", { className: "n-search-window", children: /* @__PURE__ */ n("div", { className: "search-links", children: e && e.length > 1 ? /* @__PURE__ */ n(d, { searchLoading: r, searchTerm: e, results: c }) : i ? /* @__PURE__ */ n(o, { children: [
34
+ /* @__PURE__ */ n(
35
+ "button",
38
36
  {
39
- searchLoading: s,
40
- searchTerm: r,
41
- results: n
37
+ class: "btn-ask-netlify n-search-link",
38
+ onClick: () => {
39
+ l({ current: "ask" });
40
+ },
41
+ children: [
42
+ /* @__PURE__ */ n("span", { className: "n-search-link-icon", children: /* @__PURE__ */ n(a, { name: "netlify" }) }),
43
+ /* @__PURE__ */ n("div", { className: "n-search-link-body", children: /* @__PURE__ */ n("p", { className: "n-search-link-title", children: "Ask Netlify AI" }) }),
44
+ /* @__PURE__ */ n("div", { className: "n-search-link-icon", children: /* @__PURE__ */ n(a, { name: "caretRight" }) })
45
+ ]
42
46
  }
43
- ) : l || null
44
- ] }) });
47
+ ),
48
+ i
49
+ ] }) : null }) });
45
50
  }
46
51
  export {
47
- p as default
52
+ S as default
48
53
  };
@@ -1,6 +1,6 @@
1
- import { y as l } from "../../../../chunks/hooks.module.CNV9mxng.js";
2
- function s(r, t, o, c) {
3
- l(() => {
1
+ import { y as f } from "../../../../chunks/hooks.module.DeYLzLnU.js";
2
+ function k(r, t, o, c) {
3
+ f(() => {
4
4
  if (!r) return;
5
5
  const u = (e) => {
6
6
  if (o) {
@@ -12,8 +12,8 @@ function s(r, t, o, c) {
12
12
  e.preventDefault();
13
13
  const d = t.current;
14
14
  if (!d) return;
15
- const n = Array.from(d.querySelectorAll("a")), y = n.findIndex((i) => i === document.activeElement), f = e.key === "ArrowDown" ? (y + 1) % n.length : (y - 1 + n.length) % n.length;
16
- n[f].focus();
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;
16
+ n[i].focus();
17
17
  }
18
18
  }
19
19
  };
@@ -21,5 +21,5 @@ function s(r, t, o, c) {
21
21
  }, [r, t, o, c]);
22
22
  }
23
23
  export {
24
- s as useKeyboardNav
24
+ k as useKeyboardNav
25
25
  };
@@ -1,5 +1,5 @@
1
- import { d as g, A as w } from "../../../../chunks/hooks.module.CNV9mxng.js";
2
- import { u as S } from "../../../../chunks/useTimeout.DOkYFG64.js";
1
+ import { d as g, A as w } from "../../../../chunks/hooks.module.DeYLzLnU.js";
2
+ import { u as S } from "../../../../chunks/useTimeout.DYuvQwFN.js";
3
3
  function x() {
4
4
  const [l, r] = g({
5
5
  searchTerm: "",
@@ -1,4 +1,4 @@
1
- import { y as u } from "../../../../chunks/hooks.module.CNV9mxng.js";
1
+ import { y as u } from "../../../../chunks/hooks.module.DeYLzLnU.js";
2
2
  function a(t, r, n, o) {
3
3
  u(() => {
4
4
  if (!t) return;
@@ -1,4 +1,4 @@
1
- import { A as y, y as h, q as k } from "../../../../chunks/hooks.module.CNV9mxng.js";
1
+ import { A as y, y as h, q as k } from "../../../../chunks/hooks.module.DeYLzLnU.js";
2
2
  class s {
3
3
  /**
4
4
  * Pushes an event payload into the dataLayer.
@@ -1,4 +1,4 @@
1
- import { y as c } from "../../../../chunks/hooks.module.CNV9mxng.js";
1
+ import { y as c } from "../../../../chunks/hooks.module.DeYLzLnU.js";
2
2
  function n(r, o, a) {
3
3
  c(() => {
4
4
  if (typeof location > "u" || r) return;
@@ -1,4 +1,4 @@
1
- import { y as l } from "../../../../chunks/hooks.module.CNV9mxng.js";
1
+ import { y as l } from "../../../../chunks/hooks.module.DeYLzLnU.js";
2
2
  function i(c, r) {
3
3
  l(() => {
4
4
  if (!c) return;
@@ -8,6 +8,9 @@ export interface SearchLinkProps {
8
8
  excerpt?: string;
9
9
  }
10
10
  export interface SearchWindowProps {
11
+ setModalState: (e: {
12
+ current: string;
13
+ }) => void;
11
14
  searchLoading: boolean;
12
15
  searchTerm?: string;
13
16
  results?: SearchLinkProps[];
@@ -4,5 +4,6 @@ export { default as Icon } from './Icon';
4
4
  export { default as SearchLink } from './SearchModal/components/SearchLink/SearchLink';
5
5
  export { default as SearchHeading } from './SearchModal/components/SearchHeading/SearchHeading';
6
6
  export { default as SearchToggle } from './SearchModal/components/SearchToggle/SearchToggle';
7
+ export { default as AskNetlify } from './AskNetlify/AskNetlify';
7
8
  export { SearchModal } from './SearchModal';
8
9
  export { type IconName } from './Icon';
@@ -3,16 +3,18 @@ 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
5
  import { default as x } from "./SearchModal/components/SearchHeading/SearchHeading.js";
6
- import { default as h } from "./SearchModal/components/SearchToggle/SearchToggle.js";
6
+ import { default as i } from "./SearchModal/components/SearchToggle/SearchToggle.js";
7
+ import { default as S } from "./AskNetlify/AskNetlify.js";
7
8
  import "preact";
8
- import "../../chunks/hooks.module.CNV9mxng.js";
9
- import { default as S } from "./SearchModal/components/SearchModal/SearchModal.js";
9
+ import "../../chunks/hooks.module.DeYLzLnU.js";
10
+ import { default as n } from "./SearchModal/components/SearchModal/SearchModal.js";
10
11
  export {
12
+ S as AskNetlify,
11
13
  m as Icon,
12
14
  t as KeyboardKey,
13
15
  d as Modal,
14
16
  x as SearchHeading,
15
17
  s as SearchLink,
16
- S as SearchModal,
17
- h as SearchToggle
18
+ n as SearchModal,
19
+ i as SearchToggle
18
20
  };
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.0.2",
4
+ "version": "1.0.3-alpha.0",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -33,9 +33,11 @@
33
33
  "./analytics": "./packages/analytics/index.ts"
34
34
  },
35
35
  "dependencies": {
36
+ "@kapaai/react-sdk": "^0.0.5",
36
37
  "@preact/preset-vite": "^2.10.1",
37
38
  "@shikijs/transformers": "^3.3.0",
38
39
  "glob": "^11.0.1",
40
+ "marked": "^15.0.11",
39
41
  "preact": "^10.26.4",
40
42
  "vite": "^6.2.5",
41
43
  "vite-plugin-dts": "^4.5.3",
@@ -64,4 +66,4 @@
64
66
  "prettier": "^3.5.3",
65
67
  "prettier-plugin-astro": "^0.14.1"
66
68
  }
67
- }
69
+ }
@@ -6,4 +6,5 @@ export { default as SearchLink } from './preact/SearchModal/components/SearchLin
6
6
  export { default as SearchHeading } from './preact/SearchModal/components/SearchHeading/SearchHeading';
7
7
  export { default as SearchToggle } from './preact/SearchModal/components/SearchToggle/SearchToggle';
8
8
  export { default as SearchModal } from './preact/SearchModal/components/SearchModal/SearchModal';
9
+ export { default as ChatApp } from './preact/ChatApp/ChatApp';
9
10
  export { type IconName } from './preact/Icon';
@@ -0,0 +1,161 @@
1
+ .chat-container {
2
+ opacity: 0;
3
+ animation: appearContainer 350ms ease-in-out forwards;
4
+ animation-delay: 300ms;
5
+ }
6
+
7
+ @keyframes appearContainer {
8
+ 0% {
9
+ opacity: 0;
10
+ }
11
+ 100% {
12
+ opacity: 1;
13
+ }
14
+ }
15
+
16
+ .conversation {
17
+ height: calc(var(--n-search-container-height) + var(--n-search-footer-height));
18
+ padding: var(--n-search-padding-inline);
19
+ scroll-behavior: smooth;
20
+ overflow-y: auto;
21
+ display: grid;
22
+ align-items: flex-end;
23
+ gap: var(--space-s);
24
+ }
25
+
26
+ .message {
27
+ display: grid;
28
+ gap: var(--space-s);
29
+ }
30
+
31
+ .message-bubble {
32
+ padding: 1rem 1rem;
33
+ background: var(--neutral-light-100);
34
+ border-radius: var(--radius-l);
35
+ width: fit-content;
36
+ max-width: 85%;
37
+ font-size: var(--step-0);
38
+ }
39
+
40
+ .prose {
41
+ font-size: var(--step--0);
42
+
43
+ > * + * {
44
+ margin-top: var(--flow-space, var(--space-xs));
45
+ }
46
+
47
+ h1,
48
+ h2,
49
+ h3 {
50
+ font-size: var(--step-1);
51
+ }
52
+
53
+ h4,
54
+ h5,
55
+ h6 {
56
+ font-size: var(--step-0);
57
+ }
58
+
59
+ pre {
60
+ background: var(--neutral-light-700);
61
+ border-radius: var(--radius-m);
62
+ max-width: 100%;
63
+ box-sizing: border-box;
64
+ }
65
+
66
+ code {
67
+ overflow-x: scroll;
68
+ }
69
+
70
+ code[class*='language-'],
71
+ pre[class*='language-'] {
72
+ display: block;
73
+ padding: var(--space-s);
74
+ }
75
+ }
76
+
77
+ .user-message {
78
+ margin-inline-start: auto;
79
+ background: var(--blue-000);
80
+ }
81
+
82
+ .form-wrapper {
83
+ display: flex;
84
+ align-items: center;
85
+ position: relative;
86
+ height: var(--n-search-input-height);
87
+ }
88
+
89
+ .form-wrapper::after {
90
+ content: '';
91
+ display: block;
92
+ width: 100%;
93
+ height: 1px;
94
+ background: var(--neutral-light-100);
95
+ position: absolute;
96
+ top: 0;
97
+ left: 0;
98
+ }
99
+
100
+ .form-input {
101
+ border: none;
102
+ outline: none;
103
+ padding-inline: var(--n-search-padding-inline);
104
+ }
105
+
106
+ .form-submit {
107
+ border: none;
108
+ padding: 0.7rem;
109
+ border-radius: var(--radius-pill);
110
+ margin-inline-end: var(--space-2xs);
111
+ border: none;
112
+ background: var(--blue-600);
113
+ color: var(--neutral-000);
114
+ transition: filter 300ms ease-out;
115
+ }
116
+
117
+ .form-submit > svg {
118
+ width: 1rem;
119
+ height: auto;
120
+ aspect-ratio: 1 / 1;
121
+ border-radius: 1.5px;
122
+ }
123
+
124
+ .form-submit[disabled] {
125
+ filter: saturate(0);
126
+ }
127
+
128
+ .button-back {
129
+ width: fit-content;
130
+ background: transparent;
131
+ position: absolute;
132
+ padding: 0.5rem 1rem;
133
+ background: var(--color-bg);
134
+ margin: 1rem;
135
+ border-radius: 7rem;
136
+ border: 2px solid var(--color-bg-3);
137
+ border-radius: var(--radius-pill);
138
+ font-size: var(--step--2);
139
+ border: 1px solid;
140
+ cursor: pointer;
141
+ color: var(--color-text);
142
+ }
143
+
144
+ .pulsing {
145
+ display: block;
146
+ width: 1rem;
147
+ height: 1rem;
148
+ clip-path: circle(40%);
149
+ background: var(--blue-700);
150
+ animation: pulsing 2.5s infinite ease-in-out;
151
+ }
152
+
153
+ @keyframes pulsing {
154
+ 0%,
155
+ 100% {
156
+ transform: scale(0.9);
157
+ }
158
+ 50% {
159
+ transform: scale(1.05);
160
+ }
161
+ }