@netlify/spark-ui 1.12.0-alpha.0 → 1.12.0-alpha.2
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/assets/SearchLink.css +1 -1
- package/dist/assets/SearchModal.css +1 -1
- package/dist/chunks/{ChatInterface.EQAPs01R.js → AskNetlify.lrswYyKn.js} +119 -110
- package/dist/components/preact/AskNetlify/AskNetlify.d.ts +3 -3
- package/dist/components/preact/AskNetlify/AskNetlify.js +8 -34
- package/dist/components/preact/AskNetlify/components/ChatMessages.d.ts +2 -1
- package/dist/components/preact/AskNetlify/components/ChatMessages.js +25 -21
- package/dist/components/preact/AskNetlify/components/SourcesList.js +17 -13
- package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.d.ts +23 -0
- package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.js +22 -0
- package/dist/components/preact/Icon/index.js +6 -6
- package/dist/components/preact/SearchModal/components/SearchInput.js +18 -8
- package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.d.ts +1 -1
- package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +23 -22
- package/dist/components/preact/SearchModal/components/SearchLinkThemeToggle.d.ts +1 -0
- package/dist/components/preact/SearchModal/components/SearchLinkThemeToggle.js +26 -0
- package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +89 -84
- package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
- package/dist/components/preact/SearchModal/components/SearchWindow.js +55 -48
- package/dist/components/preact/SearchModal/hooks/index.d.ts +1 -1
- package/dist/components/preact/SearchModal/hooks/index.js +8 -8
- package/dist/components/preact/SearchModal/hooks/useKeyboardNav.d.ts +1 -1
- package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +11 -12
- package/dist/components/preact/SearchModal/hooks/useSearch.js +19 -19
- package/dist/components/preact/SearchModal/hooks/{useSearchLogger.d.ts → useSearchAnalytics.d.ts} +2 -2
- package/dist/components/preact/SearchModal/hooks/{useSearchLogger.js → useSearchAnalytics.js} +5 -5
- package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.d.ts +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +8 -9
- package/dist/components/preact/SearchModal/hooks/useSearchParams.d.ts +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchParams.js +14 -7
- package/dist/components/preact/SearchModal/hooks/useSearchToggles.d.ts +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +7 -8
- package/dist/components/preact/SearchModal/types/search.types.d.ts +11 -4
- package/dist/components/preact/index.js +3 -3
- package/package.json +1 -1
- package/packages/components/preact/AskNetlify/AskNetlify.css +41 -1
- package/packages/components/preact/AskNetlify/AskNetlify.tsx +98 -34
- package/packages/components/preact/AskNetlify/components/ChatMessages.tsx +9 -7
- package/packages/components/preact/AskNetlify/components/SourcesList.tsx +24 -16
- package/packages/components/preact/AskNetlify/hooks/useAskAnalytics.tsx +50 -0
- package/packages/components/preact/Icon/index.tsx +2 -2
- package/packages/components/preact/SearchModal/components/SearchInput.tsx +10 -0
- package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +5 -0
- package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.tsx +6 -4
- package/packages/components/preact/SearchModal/components/SearchLinkThemeToggle.tsx +19 -0
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +33 -3
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +73 -89
- package/packages/components/preact/SearchModal/components/SearchWindow.tsx +64 -46
- package/packages/components/preact/SearchModal/hooks/index.ts +1 -1
- package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +1 -3
- package/packages/components/preact/SearchModal/hooks/useSearch.ts +20 -16
- package/packages/components/preact/SearchModal/hooks/{useSearchLogger.ts → useSearchAnalytics.ts} +9 -10
- package/packages/components/preact/SearchModal/hooks/useSearchHotkeys.ts +2 -4
- package/packages/components/preact/SearchModal/hooks/useSearchParams.ts +24 -2
- package/packages/components/preact/SearchModal/hooks/useSearchToggles.ts +1 -3
- package/packages/components/preact/SearchModal/types/search.types.tsx +7 -4
- package/packages/styles/loaders.css +18 -0
- package/packages/styles/tokens.css +4 -0
- package/dist/components/preact/AskNetlify/components/ChatInterface.d.ts +0 -7
- package/dist/components/preact/AskNetlify/components/ChatInterface.js +0 -10
- package/packages/components/preact/AskNetlify/components/ChatInterface.tsx +0 -94
|
@@ -1,56 +1,63 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Fragment as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
function w({
|
|
37
|
+
setModalState: i,
|
|
38
|
+
searchLoading: l,
|
|
39
|
+
searchTerm: e,
|
|
40
|
+
results: s,
|
|
35
41
|
children: c
|
|
36
42
|
}) {
|
|
37
|
-
|
|
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__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
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
|
-
|
|
62
|
+
w as default
|
|
56
63
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useSearch } from '../hooks/useSearch';
|
|
2
|
-
export {
|
|
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 {
|
|
3
|
-
import { useKeyboardNav as
|
|
4
|
-
import { useSearchHotkeys as
|
|
5
|
-
import { useSearchParams as
|
|
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
|
-
|
|
8
|
+
m as useKeyboardNav,
|
|
9
9
|
o as useSearch,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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(
|
|
14
|
+
export declare function useKeyboardNav(containerRef: RefObject<HTMLElement>, isOpen: boolean, onClose: () => void): void;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { y as
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
7
|
+
o();
|
|
9
8
|
return;
|
|
10
9
|
}
|
|
11
10
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
12
11
|
e.preventDefault();
|
|
13
|
-
const d =
|
|
12
|
+
const d = r.current;
|
|
14
13
|
if (!d) return;
|
|
15
|
-
const n = Array.from(d.querySelectorAll(".n-search-link")),
|
|
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",
|
|
21
|
-
}, [r, t, o
|
|
19
|
+
return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
|
|
20
|
+
}, [r, t, o]);
|
|
22
21
|
}
|
|
23
22
|
export {
|
|
24
|
-
|
|
23
|
+
a as useKeyboardNav
|
|
25
24
|
};
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { d as
|
|
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 [
|
|
4
|
+
const [d, s] = p({
|
|
5
5
|
searchTerm: "",
|
|
6
6
|
results: [],
|
|
7
7
|
isLoading: !1
|
|
8
|
-
}), n = w(/* @__PURE__ */ new Map()), { reset:
|
|
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
|
|
11
|
+
var o;
|
|
12
12
|
if (!(window != null && window.pagefind)) return;
|
|
13
|
-
if (
|
|
14
|
-
|
|
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),
|
|
22
|
-
(
|
|
23
|
-
var
|
|
24
|
-
const
|
|
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: (
|
|
28
|
-
label: (u =
|
|
29
|
-
url:
|
|
30
|
-
excerpt: f(
|
|
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
|
-
|
|
34
|
+
n.current.set(e, i), s((a) => ({
|
|
35
35
|
...a,
|
|
36
|
-
results:
|
|
36
|
+
results: i,
|
|
37
37
|
isLoading: !1
|
|
38
38
|
}));
|
|
39
39
|
};
|
|
40
40
|
return {
|
|
41
|
-
state:
|
|
41
|
+
state: d,
|
|
42
42
|
actions: {
|
|
43
43
|
setSearchTerm: (e) => {
|
|
44
|
-
|
|
44
|
+
s((t) => ({ ...t, results: [], searchTerm: e })), h(), m(e);
|
|
45
45
|
},
|
|
46
46
|
submitSearch: c
|
|
47
47
|
}
|
package/dist/components/preact/SearchModal/hooks/{useSearchLogger.d.ts → useSearchAnalytics.d.ts}
RENAMED
|
@@ -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 } =
|
|
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
|
|
26
|
+
export declare function useSearchAnalytics(state?: SearchState, debug?: boolean): {
|
|
27
27
|
handleClick: (e: Event) => void;
|
|
28
28
|
};
|
package/dist/components/preact/SearchModal/hooks/{useSearchLogger.js → useSearchAnalytics.js}
RENAMED
|
@@ -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
|
|
3
|
-
function
|
|
4
|
-
const n = y(new
|
|
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
|
-
|
|
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(
|
|
13
|
+
export declare function useSearchHotkeys(isOpen: boolean, onOpen: () => void, onClose: () => void): void;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { y as
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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",
|
|
9
|
-
}, [t,
|
|
7
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
8
|
+
}, [t, n, o]);
|
|
10
9
|
}
|
|
11
10
|
export {
|
|
12
|
-
|
|
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(
|
|
11
|
+
export declare function useSearchParams(setSearchTerm: (term: string) => void, onOpen: () => void): void;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
c(
|
|
4
|
-
|
|
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 && (
|
|
7
|
-
}, [
|
|
13
|
+
e && (t(e), o());
|
|
14
|
+
}, [a]);
|
|
8
15
|
}
|
|
9
16
|
export {
|
|
10
|
-
|
|
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(
|
|
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
|
|
2
|
-
function
|
|
3
|
-
|
|
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
|
|
7
|
+
const a = e.dataset.ntlSearchToggle ? e.dataset.ntlSearchToggle : "search";
|
|
9
8
|
e.removeAttribute("disabled"), e.addEventListener("click", () => {
|
|
10
|
-
t(),
|
|
9
|
+
t(), c({ current: a });
|
|
11
10
|
});
|
|
12
11
|
}), () => {
|
|
13
12
|
r.forEach((e) => e.removeEventListener("click", t));
|
|
14
13
|
};
|
|
15
|
-
}, [
|
|
14
|
+
}, [t]);
|
|
16
15
|
}
|
|
17
16
|
export {
|
|
18
|
-
|
|
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
|
|
6
|
-
label
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "1.12.0-alpha.2",
|
|
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
|
-
|
|
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;
|