@netlify/spark-ui 0.0.32 → 0.0.34
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.
|
@@ -1,106 +1,62 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { A as
|
|
1
|
+
import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
+
import { A as N, y as u, d as v } from "../../../../../chunks/hooks.module.BFfOesdf.js";
|
|
3
3
|
import T from "../../../Modal/Modal.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { useSearch as
|
|
8
|
-
import { useKeyboardNav as
|
|
9
|
-
import { useSearchHotkeys as
|
|
10
|
-
import { useSearchParams as
|
|
11
|
-
import { useSearchToggles as
|
|
12
|
-
import '../../../../../assets/SearchModal.css';function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Copyright (c) 2018 Jed Watson.
|
|
18
|
-
Licensed under the MIT License (MIT), see
|
|
19
|
-
http://jedwatson.github.io/classnames
|
|
20
|
-
*/
|
|
21
|
-
var w;
|
|
22
|
-
function C() {
|
|
23
|
-
return w || (w = 1, function(t) {
|
|
24
|
-
(function() {
|
|
25
|
-
var s = {}.hasOwnProperty;
|
|
26
|
-
function o() {
|
|
27
|
-
for (var e = "", r = 0; r < arguments.length; r++) {
|
|
28
|
-
var a = arguments[r];
|
|
29
|
-
a && (e = l(e, c(a)));
|
|
30
|
-
}
|
|
31
|
-
return e;
|
|
32
|
-
}
|
|
33
|
-
function c(e) {
|
|
34
|
-
if (typeof e == "string" || typeof e == "number")
|
|
35
|
-
return e;
|
|
36
|
-
if (typeof e != "object")
|
|
37
|
-
return "";
|
|
38
|
-
if (Array.isArray(e))
|
|
39
|
-
return o.apply(null, e);
|
|
40
|
-
if (e.toString !== Object.prototype.toString && !e.toString.toString().includes("[native code]"))
|
|
41
|
-
return e.toString();
|
|
42
|
-
var r = "";
|
|
43
|
-
for (var a in e)
|
|
44
|
-
s.call(e, a) && e[a] && (r = l(r, a));
|
|
45
|
-
return r;
|
|
46
|
-
}
|
|
47
|
-
function l(e, r) {
|
|
48
|
-
return r ? e ? e + " " + r : e + r : e;
|
|
49
|
-
}
|
|
50
|
-
t.exports ? (o.default = o, t.exports = o) : window.classNames = o;
|
|
51
|
-
})();
|
|
52
|
-
}(h)), h.exports;
|
|
53
|
-
}
|
|
54
|
-
var M = C();
|
|
55
|
-
const A = /* @__PURE__ */ x(M);
|
|
56
|
-
function K(t) {
|
|
57
|
-
const s = O(null);
|
|
58
|
-
return v(() => {
|
|
59
|
-
function o(c) {
|
|
60
|
-
s.current && !s.current.contains(c.target) && t();
|
|
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 { useKeyboardNav as L } from "../../hooks/useKeyboardNav.js";
|
|
9
|
+
import { useSearchHotkeys as O } from "../../hooks/useSearchHotkeys.js";
|
|
10
|
+
import { useSearchParams as P } from "../../hooks/useSearchParams.js";
|
|
11
|
+
import { useSearchToggles as E } from "../../hooks/useSearchToggles.js";
|
|
12
|
+
import '../../../../../assets/SearchModal.css';function K(s) {
|
|
13
|
+
const r = N(null);
|
|
14
|
+
return u(() => {
|
|
15
|
+
function t(i) {
|
|
16
|
+
r.current && !r.current.contains(i.target) && s();
|
|
61
17
|
}
|
|
62
|
-
return document.addEventListener("mousedown",
|
|
63
|
-
document.removeEventListener("mousedown",
|
|
18
|
+
return document.addEventListener("mousedown", t), () => {
|
|
19
|
+
document.removeEventListener("mousedown", t);
|
|
64
20
|
};
|
|
65
|
-
}, [
|
|
21
|
+
}, [s]), r;
|
|
66
22
|
}
|
|
67
|
-
function
|
|
68
|
-
const [
|
|
69
|
-
|
|
70
|
-
let
|
|
71
|
-
const
|
|
72
|
-
window.pagefind && (
|
|
23
|
+
function j(s = { className: "", children: null }) {
|
|
24
|
+
const [r, t] = v(!1);
|
|
25
|
+
u(() => {
|
|
26
|
+
let c;
|
|
27
|
+
const S = () => {
|
|
28
|
+
window.pagefind && (t(!0), c && clearInterval(c));
|
|
73
29
|
};
|
|
74
|
-
return
|
|
30
|
+
return S(), c = setInterval(S, 100), () => clearInterval(c);
|
|
75
31
|
}, []);
|
|
76
|
-
const { children:
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
32
|
+
const { children: i, className: f, ...g } = s, { state: n, actions: h } = I(), [o, p] = v(!1), l = () => p(!0), m = () => p(!1), a = N(null), y = K(m);
|
|
33
|
+
return E(r, l), P(r, h.setSearchTerm, l), O(r, o, l, m), L(r, a, o, m), u(() => {
|
|
34
|
+
a.current && (o ? a.current.showModal() : a.current.close());
|
|
35
|
+
}, [o]), /* @__PURE__ */ e(T, { ref: a, className: `n-search-modal ${f || ""}`, ...g, children: /* @__PURE__ */ e("div", { ref: y, className: "n-search-container", children: [
|
|
36
|
+
/* @__PURE__ */ e(w, { setSearchTerm: h.setSearchTerm, initialValue: n.searchTerm }),
|
|
37
|
+
/* @__PURE__ */ e(
|
|
38
|
+
k,
|
|
83
39
|
{
|
|
84
|
-
searchLoading:
|
|
85
|
-
searchTerm:
|
|
86
|
-
results:
|
|
87
|
-
children:
|
|
40
|
+
searchLoading: n.isLoading,
|
|
41
|
+
searchTerm: n.searchTerm,
|
|
42
|
+
results: n.results,
|
|
43
|
+
children: i
|
|
88
44
|
}
|
|
89
45
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ e("div", { className: "n-search-footer", children: [
|
|
47
|
+
/* @__PURE__ */ e("p", { className: "n-search-footer-tip", children: [
|
|
48
|
+
/* @__PURE__ */ e(d, { keyNames: ["Esc"] }),
|
|
93
49
|
"to close"
|
|
94
50
|
] }),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ e("p", { className: "n-search-footer-tip", children: [
|
|
52
|
+
/* @__PURE__ */ e(d, { keyNames: ["Tab"] }),
|
|
53
|
+
/* @__PURE__ */ e("span", { children: "or" }),
|
|
54
|
+
/* @__PURE__ */ e(d, { keyNames: ["↑", "↓"] }),
|
|
99
55
|
"to navigate"
|
|
100
56
|
] })
|
|
101
57
|
] })
|
|
102
58
|
] }) });
|
|
103
59
|
}
|
|
104
60
|
export {
|
|
105
|
-
|
|
61
|
+
j as default
|
|
106
62
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/spark-ui",
|
|
3
3
|
"description": "Assets, design tokens, components, and utilities",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.34",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/preact/index.js",
|
|
7
7
|
"types": "dist/components/preact/index.d.ts",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@preact/preset-vite": "^2.10.1",
|
|
35
|
-
"classnames": "^2.5.1",
|
|
36
35
|
"glob": "^11.0.1",
|
|
37
36
|
"preact": "^10.26.4",
|
|
38
37
|
"vite": "^6.2.5",
|
|
@@ -57,4 +56,4 @@
|
|
|
57
56
|
"prettier": "^3.5.3",
|
|
58
57
|
"prettier-plugin-astro": "^0.14.1"
|
|
59
58
|
}
|
|
60
|
-
}
|
|
59
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ComponentChildren } from 'preact';
|
|
2
2
|
import { useState, useEffect, useRef } from 'preact/hooks';
|
|
3
|
-
import cn from "classnames"
|
|
4
3
|
|
|
5
4
|
import Modal from '../../../../preact/Modal/Modal';
|
|
6
5
|
import KeyboardKey from '../../../../preact/KeyboardKey/KeyboardKey';
|
|
@@ -66,7 +65,7 @@ function SearchModal(props: Props = {className: '', children: null}) {
|
|
|
66
65
|
}, [searchOpen]);
|
|
67
66
|
|
|
68
67
|
return (
|
|
69
|
-
<Modal ref={modalRef} className={
|
|
68
|
+
<Modal ref={modalRef} className={`n-search-modal ${className ? className : ''}`} {...rest}>
|
|
70
69
|
<div ref={containerRef} className="n-search-container">
|
|
71
70
|
<SearchInput setSearchTerm={actions.setSearchTerm} initialValue={state.searchTerm} />
|
|
72
71
|
|