@netlify/spark-ui 1.12.1 → 1.12.3
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/assets/AskNetlify.css +1 -1
- package/dist/components/preact/SearchModal/components/AskNetlifyLink.d.ts +8 -0
- package/dist/components/preact/SearchModal/components/AskNetlifyLink.js +22 -0
- package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +31 -42
- package/dist/components/preact/SearchModal/components/SearchWindow.js +27 -41
- package/package.json +1 -1
- package/packages/components/preact/AskNetlify/AskNetlify.css +4 -3
- package/packages/components/preact/SearchModal/components/AskNetlifyLink.tsx +29 -0
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +2 -10
- package/packages/components/preact/SearchModal/components/SearchWindow.tsx +1 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
.n-fadeIn{opacity:0;animation:fadeIn var(--animation-duration, .3s) ease-out forwards}.n-fadeInUp{opacity:0;transform:translateY(var(--animation-transformY, 5px));animation:fadeInUp var(--animation-duration, .3s) ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.n-ask-chat-container{opacity:0;animation:appearContainer .12s ease-in-out forwards;animation-delay:.14s}.n-ask-conversation{display:grid;align-items:flex-end;gap:var(--space-s);height:calc(var(--n-search-container-height) + var(--n-search-footer-height));padding:var(--n-search-padding-inline);overflow-y:auto;scroll-behavior:smooth;grid-template-rows:1fr}.n-ask-form{display:flex;align-items:center;position:relative;height:var(--n-search-input-height);background-color:var(--search-input-bg-color)}.n-ask-form:after{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:1px;background:var(--color-bg-3)}.n-ask-question{border:none;border-radius:var(--radius-pill);transform:translate(-.75rem);color:var(--color-text-1);background:none;padding:var(--space-2xs, .5rem);font-size:var(--step--1, .9rem);font-weight:var(--font-weight-regular);text-align:left;text-wrap:pretty;cursor:pointer;display:flex;align-items:center;gap:var(--space-2xs);transition:background-color .2s ease-out}.n-ask-question [data-icon=caretRight]{opacity:0;height:.8em;color:var(--color-text-weaker);transform:translate(-3px);transition:transform .2s ease-out}.n-ask-question:hover{background-color:var(--n-search-color-bg-2)}.n-ask-question:hover [data-icon=caretRight]{opacity:1;transform:translate(0)}.n-ask-question-list{padding:0}.n-ask-question-list .n-ask-question-list-item{position:relative;width:fit-content;opacity:0;transform:translateY(10px);animation:fadeInUp .5s forwards}.n-ask-message{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-s);font-size:var(--font-size-text-md, 1rem)}.n-ask-message:first-of-type{margin-block-start:var(--space-2xl)}.n-ask-message-bubble{width:fit-content;max-width:85%;padding:var(--space-xs) var(--space-s);background:var(--search-answer-message-color);border-radius:var(--radius-l);font-size:var(--step-0)}.n-ask-user-message{margin-inline-start:auto;background:var(--search-user-message-color)}.n-ask-sources{margin-block-start:var(--space-m)}.n-ask-sources-title{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-sources a{font-size:var(--step--1)}.n-ask-sources details summary::marker{display:none;content:none}.n-ask-sources details{background:var(--search-source-list-color);padding:var(--space-xs) var(--space-xs);border-radius:var(--radius-l)}.n-ask-sources details summary{display:flex;align-items:center;justify-content:space-between;gap:var(--space-xs);cursor:pointer}.n-ask-sources details ul{margin-block-start:var(--space-3xs)}.n-ask-sources [data-icon=caretRight]{width:.8em;display:inline-block;transform:rotate(90deg);height:auto;color:var(--color-text-weaker)}.n-ask-sources details[open] [data-icon=caretRight]{transform:rotate(270deg)}.n-ask-input{border:none;outline:none;padding-inline:var(--n-search-padding-inline)}.n-ask-form-submit{display:flex;padding:.7rem;margin-inline-end:var(--space-2xs);border:none;border-radius:var(--radius-pill);background:var(--search-submit-btn-bg-color);color:var(--neutral-000);transition:background-color .15s ease-out}.n-ask-form-submit>svg{width:1rem;height:auto;aspect-ratio:1 / 1;border-radius:1.5px;transition:opacity .15s ease-out}.n-ask-form-submit[disabled]{background:var(--neutral-500)}.n-ask-form-submit[disabled]>*{opacity:.5}.n-ask-button-back{position:absolute;z-index:1;width:fit-content;margin:1rem;padding
|
|
1
|
+
.n-fadeIn{opacity:0;animation:fadeIn var(--animation-duration, .3s) ease-out forwards}.n-fadeInUp{opacity:0;transform:translateY(var(--animation-transformY, 5px));animation:fadeInUp var(--animation-duration, .3s) ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.n-ask-chat-container{opacity:0;animation:appearContainer .12s ease-in-out forwards;animation-delay:.14s}.n-ask-conversation{display:grid;align-items:flex-end;gap:var(--space-s);height:calc(var(--n-search-container-height) + var(--n-search-footer-height));padding:var(--n-search-padding-inline);overflow-y:auto;scroll-behavior:smooth;grid-template-rows:1fr}.n-ask-form{display:flex;align-items:center;position:relative;height:var(--n-search-input-height);background-color:var(--search-input-bg-color)}.n-ask-form:after{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:1px;background:var(--color-bg-3)}.n-ask-question{border:none;border-radius:var(--radius-pill);transform:translate(-.75rem);color:var(--color-text-1);background:none;padding:var(--space-2xs, .5rem);font-size:var(--step--1, .9rem);font-weight:var(--font-weight-regular);text-align:left;text-wrap:pretty;cursor:pointer;display:flex;align-items:center;gap:var(--space-2xs);transition:background-color .2s ease-out}.n-ask-question [data-icon=caretRight]{opacity:0;height:.8em;color:var(--color-text-weaker);transform:translate(-3px);transition:transform .2s ease-out}.n-ask-question:hover{background-color:var(--n-search-color-bg-2)}.n-ask-question:hover [data-icon=caretRight]{opacity:1;transform:translate(0)}.n-ask-question-list{padding:0}.n-ask-question-list .n-ask-question-list-item{position:relative;width:fit-content;opacity:0;transform:translateY(10px);animation:fadeInUp .5s forwards}.n-ask-message{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-s);font-size:var(--font-size-text-md, 1rem)}.n-ask-message:first-of-type{margin-block-start:var(--space-2xl)}.n-ask-message-bubble{width:fit-content;max-width:85%;padding:var(--space-xs) var(--space-s);background:var(--search-answer-message-color);border-radius:var(--radius-l);font-size:var(--step-0)}.n-ask-user-message{margin-inline-start:auto;background:var(--search-user-message-color)}.n-ask-sources{margin-block-start:var(--space-m)}.n-ask-sources-title{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-sources a{font-size:var(--step--1)}.n-ask-sources details summary::marker{display:none;content:none}.n-ask-sources details{background:var(--search-source-list-color);padding:var(--space-xs) var(--space-xs);border-radius:var(--radius-l)}.n-ask-sources details summary{display:flex;align-items:center;justify-content:space-between;gap:var(--space-xs);cursor:pointer}.n-ask-sources details ul{margin-block-start:var(--space-3xs)}.n-ask-sources [data-icon=caretRight]{width:.8em;display:inline-block;transform:rotate(90deg);height:auto;color:var(--color-text-weaker)}.n-ask-sources details[open] [data-icon=caretRight]{transform:rotate(270deg)}.n-ask-input{border:none;outline:none;padding-inline:var(--n-search-padding-inline)}.n-ask-form-submit{display:flex;padding:.7rem;margin-inline-end:var(--space-2xs);border:none;border-radius:var(--radius-pill);background:var(--search-submit-btn-bg-color);color:var(--neutral-000);transition:background-color .15s ease-out}.n-ask-form-submit>svg{width:1rem;height:auto;aspect-ratio:1 / 1;border-radius:1.5px;transition:opacity .15s ease-out}.n-ask-form-submit[disabled]{background:var(--neutral-500)}.n-ask-form-submit[disabled]>*{opacity:.5}button.n-ask-button-back{position:absolute;z-index:1;width:fit-content;margin:1rem;padding:var(--space-xs) var(--space-s);background:var(--search-back-btn-bg-color);border:.5px solid var(--color-bg-3);border-radius:var(--radius-pill);font-size:var(--font-size-text-md, 1rem);font-weight:var(--font-weight-semibold, 500);color:var(--color-text-1);cursor:pointer;line-height:var(--line-height-none, 1)}button.n-ask-button-back [data-icon=caretRight]{color:var(--color-text-weak);transform:rotate(180deg)}.n-ask-prose{font-size:var(--step--0)}.n-ask-prose>*+*{margin-top:var(--flow-space, var(--space-s))}.n-ask-prose :where(ol,ul,li)>*+*{margin-top:var(--flow-space, var(--space-3xs))}.n-ask-prose h1,.n-ask-prose h2,.n-ask-prose h3{font-size:var(--step-1);font-weight:var(--font-weight-bold)}.n-ask-prose h4,.n-ask-prose h5,.n-ask-prose h6{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-prose pre{max-width:100%;padding:var(--space-s);background:var(--neutral-light-700);border-radius:var(--radius-m);box-sizing:border-box;color:var(--neutral-100);overflow-x:auto}.n-ask-prose code{overflow-x:auto}.n-ask-prose code[class*=language-],.n-ask-prose pre[class*=language-]{display:block;font-size:var(--font-size-text-xs)}.n-ask-message-loader{width:2.5rem;height:auto;display:block;color:var(--search-loading-color)}.n-ask-message-loader :where(#ask-netlify-tick-1,#ask-netlify-tick-2,#ask-netlify-tick-3){opacity:0;animation:fadeIn .8s ease-in-out infinite}.n-ask-message-loader #ask-netlify-tick-1{animation-delay:.1s}.n-ask-message-loader #ask-netlify-tick-2{animation-delay:.2s}.n-ask-message-loader #ask-netlify-tick-3{animation-delay:.3s}.n-ask-message-loader :where(#ask-netlify-eyelid-left,#ask-netlify-eyelid-right){--n-ask-netlify-eyelid-color: var(--search-bg-color);transform-origin:top center;transform:scaleY(1.035);animation:askEyeBlink 4s infinite;animation-delay:1s}@keyframes askEyeBlink{0%,5%{transform:scaleY(1.035)}6%,10%{transform:scaleY(1.3)}11%,15%{transform:scaleY(1.035)}16%,20%{transform:scaleY(1.3)}21%,to{transform:scaleY(1.035)}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { u as t } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
+
import a from "./SearchLink/SearchLink.js";
|
|
3
|
+
import { Fragment as n } from "preact";
|
|
4
|
+
const l = (e) => {
|
|
5
|
+
const r = e.searchTerm ? /* @__PURE__ */ t(n, { children: [
|
|
6
|
+
"Ask Netlify AI: ",
|
|
7
|
+
/* @__PURE__ */ t("span", { className: "n-search-term", children: e.searchTerm })
|
|
8
|
+
] }) : "Ask Netlify AI";
|
|
9
|
+
return /* @__PURE__ */ t(
|
|
10
|
+
a,
|
|
11
|
+
{
|
|
12
|
+
as: "button",
|
|
13
|
+
icon: "askNetlify",
|
|
14
|
+
excerpt: "Get instant answers, powered by AI",
|
|
15
|
+
onClick: () => e.setModalState({ current: "ask" }),
|
|
16
|
+
children: r
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
l as default
|
|
22
|
+
};
|
|
@@ -1,81 +1,70 @@
|
|
|
1
1
|
import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
-
import { A as g, y as h, d as
|
|
3
|
-
import { A as
|
|
2
|
+
import { A as g, y as h, d as k } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
|
|
3
|
+
import { A as w, K as b } from "../../../../../chunks/AskNetlify.lrswYyKn.js";
|
|
4
4
|
import K from "../../../Modal/Modal.js";
|
|
5
5
|
import d from "../../../KeyboardKey/KeyboardKey.js";
|
|
6
6
|
import L from "../SearchWindow.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useSearch as
|
|
7
|
+
import M from "../SearchInput.js";
|
|
8
|
+
import O from "../AskNetlifyLink.js";
|
|
9
|
+
import { useSearch as C } from "../../hooks/useSearch.js";
|
|
10
10
|
import { useSearchAnalytics as E } from "../../hooks/useSearchAnalytics.js";
|
|
11
11
|
import { useKeyboardNav as Q } from "../../hooks/useKeyboardNav.js";
|
|
12
|
-
import { useSearchHotkeys as
|
|
13
|
-
import { useSearchParams as
|
|
14
|
-
import { useSearchToggles as
|
|
15
|
-
import { useAskAnalytics as
|
|
12
|
+
import { useSearchHotkeys as P } from "../../hooks/useSearchHotkeys.js";
|
|
13
|
+
import { useSearchParams as R } from "../../hooks/useSearchParams.js";
|
|
14
|
+
import { useSearchToggles as q } from "../../hooks/useSearchToggles.js";
|
|
15
|
+
import { useAskAnalytics as x } from "../../../AskNetlify/hooks/useAskAnalytics.js";
|
|
16
16
|
import { Fragment as N } from "preact";
|
|
17
|
-
import '../../../../../assets/SearchModal.css';function
|
|
17
|
+
import '../../../../../assets/SearchModal.css';function D(t) {
|
|
18
18
|
const n = g(null);
|
|
19
19
|
return h(() => {
|
|
20
20
|
function o(m) {
|
|
21
|
-
n.current && !n.current.contains(m.target) &&
|
|
21
|
+
n.current && !n.current.contains(m.target) && t();
|
|
22
22
|
}
|
|
23
23
|
return document.addEventListener("mousedown", o), () => {
|
|
24
24
|
document.removeEventListener("mousedown", o);
|
|
25
25
|
};
|
|
26
|
-
}, [
|
|
26
|
+
}, [t]), n;
|
|
27
27
|
}
|
|
28
|
-
function re(
|
|
29
|
-
const { children: n, className: o, debug: m, ...
|
|
30
|
-
|
|
31
|
-
const { handleNewQuery:
|
|
28
|
+
function re(t = { className: "", children: void 0, debug: !1, kapaIntegrationId: void 0 }) {
|
|
29
|
+
const { children: n, className: o, debug: m, ...T } = t, [s, c] = k({ current: "search" }), [i, f] = k(!1), l = () => f(!0), u = () => f(!1), a = g(null), v = D(u), { state: r, actions: p } = C();
|
|
30
|
+
q(l, c), R(p.setSearchTerm, l), P(i, l, u), Q(a, i, u), E(r, m);
|
|
31
|
+
const { handleNewQuery: A, handleAnswer: I } = x();
|
|
32
32
|
return h(() => {
|
|
33
|
-
|
|
33
|
+
a.current && (i ? a.current.showModal() : a.current.close());
|
|
34
34
|
}, [i]), h(() => {
|
|
35
|
-
var
|
|
36
|
-
const S = (
|
|
35
|
+
var y;
|
|
36
|
+
const S = (y = a.current) == null ? void 0 : y.querySelector("input");
|
|
37
37
|
S && S.focus();
|
|
38
38
|
}, [s.current]), /* @__PURE__ */ e(
|
|
39
|
-
|
|
39
|
+
b,
|
|
40
40
|
{
|
|
41
|
-
integrationId:
|
|
41
|
+
integrationId: t.kapaIntegrationId || "",
|
|
42
42
|
callbacks: {
|
|
43
43
|
askAI: {
|
|
44
|
-
onQuerySubmit:
|
|
45
|
-
onAnswerGenerationCompleted:
|
|
44
|
+
onQuerySubmit: A,
|
|
45
|
+
onAnswerGenerationCompleted: I
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
children: /* @__PURE__ */ e(
|
|
49
49
|
K,
|
|
50
50
|
{
|
|
51
|
-
ref:
|
|
51
|
+
ref: a,
|
|
52
52
|
className: `n-search-modal ${o || ""}`,
|
|
53
53
|
"data-state": s.current,
|
|
54
|
-
...
|
|
54
|
+
...T,
|
|
55
55
|
children: /* @__PURE__ */ e("div", { ref: v, className: "n-search-container", children: [
|
|
56
|
-
s.current === "ask" && /* @__PURE__ */ e(
|
|
56
|
+
s.current === "ask" && /* @__PURE__ */ e(w, { setModalState: c, initialQuery: r.searchTerm }),
|
|
57
57
|
s.current === "search" && /* @__PURE__ */ e(N, { children: [
|
|
58
|
-
/* @__PURE__ */ e(
|
|
58
|
+
/* @__PURE__ */ e(M, { setSearchTerm: p.setSearchTerm, initialValue: r.searchTerm }),
|
|
59
59
|
/* @__PURE__ */ e(
|
|
60
60
|
L,
|
|
61
61
|
{
|
|
62
62
|
setModalState: c,
|
|
63
|
-
searchLoading:
|
|
64
|
-
searchTerm:
|
|
65
|
-
results:
|
|
63
|
+
searchLoading: r.isLoading,
|
|
64
|
+
searchTerm: r.searchTerm,
|
|
65
|
+
results: r.results,
|
|
66
66
|
children: /* @__PURE__ */ e(N, { children: [
|
|
67
|
-
|
|
68
|
-
M,
|
|
69
|
-
{
|
|
70
|
-
as: "button",
|
|
71
|
-
icon: "askNetlify",
|
|
72
|
-
label: "Ask Netlify",
|
|
73
|
-
excerpt: "Get an instant AI-generated answer",
|
|
74
|
-
onClick: () => {
|
|
75
|
-
c({ current: "ask" });
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
),
|
|
67
|
+
t.kapaIntegrationId && /* @__PURE__ */ e(O, { searchTerm: r.searchTerm, setModalState: c }),
|
|
79
68
|
n
|
|
80
69
|
] })
|
|
81
70
|
}
|
|
@@ -1,63 +1,49 @@
|
|
|
1
1
|
import { u as n } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import t from "./SearchHeading/SearchHeading.js";
|
|
3
|
+
import h from "./SearchLink/SearchLink.js";
|
|
4
4
|
import m from "./SearchLinkThemeToggle.js";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
setModalState: c
|
|
9
|
-
}) => /* @__PURE__ */ n(
|
|
10
|
-
t,
|
|
11
|
-
{
|
|
12
|
-
as: "button",
|
|
13
|
-
icon: "askNetlify",
|
|
14
|
-
excerpt: "Get an instant AI-generated answer",
|
|
15
|
-
onClick: () => c({ current: "ask" }),
|
|
16
|
-
children: [
|
|
17
|
-
"Ask Netlify AI: ",
|
|
18
|
-
/* @__PURE__ */ n("span", { className: "n-search-term", children: e })
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
), f = ({ searchTerm: e }) => /* @__PURE__ */ n("div", { className: "n-search-feedback", children: /* @__PURE__ */ n("p", { className: "n-results-info", children: [
|
|
5
|
+
import o from "./AskNetlifyLink.js";
|
|
6
|
+
import { Fragment as a } from "preact";
|
|
7
|
+
const f = ({ searchTerm: l }) => /* @__PURE__ */ n("div", { className: "n-search-feedback", children: /* @__PURE__ */ n("p", { className: "n-results-info", children: [
|
|
22
8
|
"0 results for ",
|
|
23
|
-
/* @__PURE__ */ n("span", { className: "n-search-term", children:
|
|
24
|
-
] }) }),
|
|
25
|
-
setModalState:
|
|
9
|
+
/* @__PURE__ */ n("span", { className: "n-search-term", children: l })
|
|
10
|
+
] }) }), p = ({
|
|
11
|
+
setModalState: l,
|
|
26
12
|
searchLoading: c,
|
|
27
13
|
searchTerm: i,
|
|
28
|
-
results:
|
|
14
|
+
results: e
|
|
29
15
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */ n(
|
|
32
|
-
/* @__PURE__ */ n(o, { searchTerm: i, setModalState:
|
|
33
|
-
|
|
16
|
+
const s = !c && (!e || e.length === 0);
|
|
17
|
+
return /* @__PURE__ */ n(a, { children: [
|
|
18
|
+
/* @__PURE__ */ n(o, { searchTerm: i, setModalState: l }),
|
|
19
|
+
s ? /* @__PURE__ */ n(f, { searchTerm: i }) : /* @__PURE__ */ n("ul", { className: "n-results-list", role: "list", children: e == null ? void 0 : e.map((r, d) => /* @__PURE__ */ n("li", { className: "n-results-list-item", children: /* @__PURE__ */ n(h, { ...r }) }, d)) })
|
|
34
20
|
] });
|
|
35
21
|
};
|
|
36
|
-
function
|
|
37
|
-
setModalState:
|
|
22
|
+
function w({
|
|
23
|
+
setModalState: l,
|
|
38
24
|
searchLoading: c,
|
|
39
25
|
searchTerm: i,
|
|
40
|
-
results:
|
|
41
|
-
children:
|
|
26
|
+
results: e,
|
|
27
|
+
children: s
|
|
42
28
|
}) {
|
|
43
|
-
const
|
|
44
|
-
return /* @__PURE__ */ n("div", { className: "n-search-window", children: /* @__PURE__ */ n("div", { className: "n-search-links", children:
|
|
45
|
-
/* @__PURE__ */ n(o, { searchTerm: i, setModalState:
|
|
29
|
+
const r = (i == null ? void 0 : i.length) > 1;
|
|
30
|
+
return /* @__PURE__ */ n("div", { className: "n-search-window", children: /* @__PURE__ */ n("div", { className: "n-search-links", children: r ? c ? /* @__PURE__ */ n(a, { children: [
|
|
31
|
+
/* @__PURE__ */ n(o, { searchTerm: i, setModalState: l }),
|
|
46
32
|
/* @__PURE__ */ n("div", { className: "n-search-feedback", children: /* @__PURE__ */ n("div", { className: "n-loader-dots-spinner" }) })
|
|
47
33
|
] }) : /* @__PURE__ */ n(
|
|
48
|
-
|
|
34
|
+
p,
|
|
49
35
|
{
|
|
50
|
-
setModalState:
|
|
36
|
+
setModalState: l,
|
|
51
37
|
searchLoading: c,
|
|
52
38
|
searchTerm: i,
|
|
53
|
-
results:
|
|
39
|
+
results: e
|
|
54
40
|
}
|
|
55
|
-
) : /* @__PURE__ */ n(
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */ n(
|
|
41
|
+
) : /* @__PURE__ */ n(a, { children: [
|
|
42
|
+
s,
|
|
43
|
+
/* @__PURE__ */ n(t, { children: "Actions" }),
|
|
58
44
|
/* @__PURE__ */ n(m, {})
|
|
59
45
|
] }) }) });
|
|
60
46
|
}
|
|
61
47
|
export {
|
|
62
|
-
|
|
48
|
+
w as default
|
|
63
49
|
};
|
package/package.json
CHANGED
|
@@ -201,12 +201,12 @@
|
|
|
201
201
|
/* ----------------------------- */
|
|
202
202
|
/* Buttons */
|
|
203
203
|
/* ----------------------------- */
|
|
204
|
-
.n-ask-button-back {
|
|
204
|
+
button.n-ask-button-back {
|
|
205
205
|
position: absolute;
|
|
206
206
|
z-index: 1;
|
|
207
207
|
width: fit-content;
|
|
208
208
|
margin: 1rem;
|
|
209
|
-
padding:
|
|
209
|
+
padding: var(--space-xs) var(--space-s);
|
|
210
210
|
background: var(--search-back-btn-bg-color);
|
|
211
211
|
border: 0.5px solid var(--color-bg-3);
|
|
212
212
|
border-radius: var(--radius-pill);
|
|
@@ -214,9 +214,10 @@
|
|
|
214
214
|
font-weight: var(--font-weight-semibold, 500);
|
|
215
215
|
color: var(--color-text-1);
|
|
216
216
|
cursor: pointer;
|
|
217
|
+
line-height: var(--line-height-none, 1);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
.n-ask-button-back [data-icon='caretRight'] {
|
|
220
|
+
button.n-ask-button-back [data-icon='caretRight'] {
|
|
220
221
|
color: var(--color-text-weak);
|
|
221
222
|
transform: rotate(180deg);
|
|
222
223
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import SearchLink from './SearchLink/SearchLink';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
setModalState: (state: { current: string }) => void;
|
|
5
|
+
searchTerm: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const AskNetlifyLink = (props: Props) => {
|
|
9
|
+
const label = props.searchTerm ? (
|
|
10
|
+
<>
|
|
11
|
+
Ask Netlify AI: <span className="n-search-term">{props.searchTerm}</span>
|
|
12
|
+
</>
|
|
13
|
+
) : (
|
|
14
|
+
'Ask Netlify AI'
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<SearchLink
|
|
19
|
+
as="button"
|
|
20
|
+
icon="askNetlify"
|
|
21
|
+
excerpt="Get instant answers, powered by AI"
|
|
22
|
+
onClick={() => props.setModalState({ current: 'ask' })}
|
|
23
|
+
>
|
|
24
|
+
{label}
|
|
25
|
+
</SearchLink>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default AskNetlifyLink;
|
|
@@ -7,7 +7,7 @@ import Modal from '../../../../preact/Modal/Modal';
|
|
|
7
7
|
import KeyboardKey from '../../../../preact/KeyboardKey/KeyboardKey';
|
|
8
8
|
import SearchWindow from '../../components/SearchWindow';
|
|
9
9
|
import SearchInput from '../../components/SearchInput';
|
|
10
|
-
import
|
|
10
|
+
import AskNetlifyLink from '../AskNetlifyLink';
|
|
11
11
|
import { useClickOutside } from '../../../../../utils/useClickOutside';
|
|
12
12
|
import {
|
|
13
13
|
useSearch,
|
|
@@ -93,15 +93,7 @@ function SearchModal(
|
|
|
93
93
|
>
|
|
94
94
|
<>
|
|
95
95
|
{props.kapaIntegrationId && (
|
|
96
|
-
<
|
|
97
|
-
as="button"
|
|
98
|
-
icon="askNetlify"
|
|
99
|
-
label="Ask Netlify"
|
|
100
|
-
excerpt="Get an instant AI-generated answer"
|
|
101
|
-
onClick={() => {
|
|
102
|
-
setModalState({ current: 'ask' });
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
96
|
+
<AskNetlifyLink searchTerm={state.searchTerm} setModalState={setModalState} />
|
|
105
97
|
)}
|
|
106
98
|
{children}
|
|
107
99
|
</>
|
|
@@ -3,23 +3,7 @@ import type { SearchResultsProps, SearchWindowProps } from '../types/search.type
|
|
|
3
3
|
import SearchHeading from './SearchHeading/SearchHeading';
|
|
4
4
|
import SearchLink from './SearchLink/SearchLink';
|
|
5
5
|
import SearchLinkThemeToggle from './SearchLinkThemeToggle';
|
|
6
|
-
|
|
7
|
-
const AskNetlifyLink = ({
|
|
8
|
-
searchTerm,
|
|
9
|
-
setModalState,
|
|
10
|
-
}: {
|
|
11
|
-
searchTerm: string;
|
|
12
|
-
setModalState: (state: { current: string }) => void;
|
|
13
|
-
}) => (
|
|
14
|
-
<SearchLink
|
|
15
|
-
as="button"
|
|
16
|
-
icon="askNetlify"
|
|
17
|
-
excerpt="Get an instant AI-generated answer"
|
|
18
|
-
onClick={() => setModalState({ current: 'ask' })}
|
|
19
|
-
>
|
|
20
|
-
Ask Netlify AI: <span className="n-search-term">{searchTerm}</span>
|
|
21
|
-
</SearchLink>
|
|
22
|
-
);
|
|
6
|
+
import AskNetlifyLink from './AskNetlifyLink';
|
|
23
7
|
|
|
24
8
|
const NoResults = ({ searchTerm }: { searchTerm: string }) => (
|
|
25
9
|
<div className="n-search-feedback">
|