@canopy-iiif/app 0.7.14 → 0.7.17
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/lib/AGENTS.md +66 -0
- package/lib/build/dev.js +252 -355
- package/lib/build/iiif.js +19 -50
- package/lib/build/mdx.js +42 -76
- package/lib/build/pages.js +1 -5
- package/lib/build/runtimes.js +40 -103
- package/lib/build/search.js +2 -5
- package/lib/build/styles.js +9 -15
- package/lib/common.js +16 -8
- package/lib/head.js +21 -0
- package/lib/index.js +5 -1
- package/lib/search/command-runtime.js +370 -0
- package/lib/search/search-app.jsx +2 -2
- package/lib/search/search.js +12 -191
- package/package.json +10 -3
- package/ui/dist/index.mjs +108 -83
- package/ui/dist/index.mjs.map +4 -4
- package/ui/dist/server.mjs +108 -70
- package/ui/dist/server.mjs.map +4 -4
- package/ui/styles/base/_common.scss +8 -0
- package/ui/styles/base/index.scss +1 -0
- package/ui/styles/components/_command.scss +84 -1
- package/ui/styles/components/_header.scss +0 -0
- package/ui/styles/components/_hero.scss +22 -0
- package/ui/styles/components/index.scss +2 -3
- package/ui/styles/index.css +106 -1
- package/ui/styles/index.scss +3 -2
- package/ui/tailwind-canopy-iiif-plugin.js +7 -12
- package/ui/tailwind-canopy-iiif-preset.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopy-iiif/app",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mat Jordan <mat@northwestern.edu>",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"./ui/styles/index.css": "./ui/styles/index.css",
|
|
15
15
|
"./ui/canopy-iiif-plugin": "./ui/tailwind-canopy-iiif-plugin.js",
|
|
16
16
|
"./ui/canopy-iiif-preset": "./ui/tailwind-canopy-iiif-preset.js",
|
|
17
|
-
"./lib/components/*": "./lib/components/*"
|
|
17
|
+
"./lib/components/*": "./lib/components/*",
|
|
18
|
+
"./head": "./lib/head.js"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"lib/**",
|
|
@@ -38,7 +39,13 @@
|
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"react": "^18.2.0 || ^19.0.0",
|
|
41
|
-
"react-dom": "^18.2.0 || ^19.0.0"
|
|
42
|
+
"react-dom": "^18.2.0 || ^19.0.0",
|
|
43
|
+
"tailwindcss": "^4.0.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"tailwindcss": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
42
49
|
},
|
|
43
50
|
"devDependencies": {
|
|
44
51
|
"esbuild": "^0.21.4"
|
package/ui/dist/index.mjs
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
// ui/src/Fallback.jsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
function Fallback({ name, ...props }) {
|
|
4
|
-
const style = {
|
|
5
|
-
padding: "0.75rem 1rem",
|
|
6
|
-
border: "1px dashed #d1d5db",
|
|
7
|
-
color: "#6b7280",
|
|
8
|
-
borderRadius: 6,
|
|
9
|
-
background: "#f9fafb",
|
|
10
|
-
fontSize: 14
|
|
11
|
-
};
|
|
12
|
-
return /* @__PURE__ */ React.createElement("div", { style, "data-fallback-component": name || "Unknown" }, /* @__PURE__ */ React.createElement("strong", null, name || "Unknown component"), " not available in UI.");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
1
|
// ui/src/HelloWorld.jsx
|
|
16
|
-
import
|
|
2
|
+
import React from "react";
|
|
17
3
|
var HelloWorld = () => {
|
|
18
|
-
return /* @__PURE__ */
|
|
4
|
+
return /* @__PURE__ */ React.createElement("div", null, "Hello, World!");
|
|
19
5
|
};
|
|
20
6
|
|
|
21
7
|
// ui/src/layout/Card.jsx
|
|
22
|
-
import
|
|
8
|
+
import React2, { useEffect, useRef, useState } from "react";
|
|
23
9
|
function Card({
|
|
24
10
|
href,
|
|
25
11
|
src,
|
|
@@ -75,8 +61,8 @@ function Card({
|
|
|
75
61
|
const h = Number(imgHeight);
|
|
76
62
|
const ratio = Number.isFinite(Number(aspectRatio)) && Number(aspectRatio) > 0 ? Number(aspectRatio) : Number.isFinite(w) && w > 0 && Number.isFinite(h) && h > 0 ? w / h : void 0;
|
|
77
63
|
const paddingPercent = ratio ? 100 / ratio : 100;
|
|
78
|
-
const caption = /* @__PURE__ */
|
|
79
|
-
return /* @__PURE__ */
|
|
64
|
+
const caption = /* @__PURE__ */ React2.createElement("figcaption", null, title && /* @__PURE__ */ React2.createElement("span", null, title), subtitle && /* @__PURE__ */ React2.createElement("span", null, subtitle), children);
|
|
65
|
+
return /* @__PURE__ */ React2.createElement(
|
|
80
66
|
"a",
|
|
81
67
|
{
|
|
82
68
|
href,
|
|
@@ -88,13 +74,13 @@ function Card({
|
|
|
88
74
|
"data-image-loaded": imageLoaded ? "true" : "false",
|
|
89
75
|
...rest
|
|
90
76
|
},
|
|
91
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ React2.createElement("figure", null, src ? ratio ? /* @__PURE__ */ React2.createElement(
|
|
92
78
|
"div",
|
|
93
79
|
{
|
|
94
80
|
className: "canopy-card-media",
|
|
95
81
|
style: { "--canopy-card-padding": `${paddingPercent}%` }
|
|
96
82
|
},
|
|
97
|
-
inView ? /* @__PURE__ */
|
|
83
|
+
inView ? /* @__PURE__ */ React2.createElement(
|
|
98
84
|
"img",
|
|
99
85
|
{
|
|
100
86
|
src,
|
|
@@ -104,7 +90,7 @@ function Card({
|
|
|
104
90
|
onError: () => setImageLoaded(true)
|
|
105
91
|
}
|
|
106
92
|
) : null
|
|
107
|
-
) : /* @__PURE__ */
|
|
93
|
+
) : /* @__PURE__ */ React2.createElement(
|
|
108
94
|
"img",
|
|
109
95
|
{
|
|
110
96
|
src,
|
|
@@ -120,9 +106,9 @@ function Card({
|
|
|
120
106
|
|
|
121
107
|
// ui/src/layout/Grid.jsx
|
|
122
108
|
import Masonry from "react-masonry-css";
|
|
123
|
-
import
|
|
109
|
+
import React3 from "react";
|
|
124
110
|
function GridItem({ children, className = "", style = {}, ...rest }) {
|
|
125
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ React3.createElement(
|
|
126
112
|
"div",
|
|
127
113
|
{
|
|
128
114
|
className: `canopy-grid-item ${className}`.trim(),
|
|
@@ -150,7 +136,7 @@ function Grid({
|
|
|
150
136
|
640: 2
|
|
151
137
|
};
|
|
152
138
|
const vars = { "--grid-gap": gap, "--grid-padding-y": paddingY };
|
|
153
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ React3.createElement("div", { className: "canopy-grid-wrap" }, /* @__PURE__ */ React3.createElement(
|
|
154
140
|
"style",
|
|
155
141
|
{
|
|
156
142
|
dangerouslySetInnerHTML: {
|
|
@@ -162,7 +148,7 @@ function Grid({
|
|
|
162
148
|
`
|
|
163
149
|
}
|
|
164
150
|
}
|
|
165
|
-
), /* @__PURE__ */
|
|
151
|
+
), /* @__PURE__ */ React3.createElement(
|
|
166
152
|
Masonry,
|
|
167
153
|
{
|
|
168
154
|
breakpointCols: cols,
|
|
@@ -176,7 +162,7 @@ function Grid({
|
|
|
176
162
|
}
|
|
177
163
|
|
|
178
164
|
// ui/src/iiif/Viewer.jsx
|
|
179
|
-
import
|
|
165
|
+
import React4, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
180
166
|
var DEFAULT_VIEWER_OPTIONS = {
|
|
181
167
|
showDownload: false,
|
|
182
168
|
showIIIFBadge: false,
|
|
@@ -232,7 +218,7 @@ var Viewer = (props) => {
|
|
|
232
218
|
} catch (_) {
|
|
233
219
|
json = "{}";
|
|
234
220
|
}
|
|
235
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ React4.createElement("div", { "data-canopy-viewer": "1", className: "not-prose" }, /* @__PURE__ */ React4.createElement(
|
|
236
222
|
"script",
|
|
237
223
|
{
|
|
238
224
|
type: "application/json",
|
|
@@ -240,11 +226,11 @@ var Viewer = (props) => {
|
|
|
240
226
|
}
|
|
241
227
|
));
|
|
242
228
|
}
|
|
243
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ React4.createElement(CloverViewer, { ...props, options: mergedOptions });
|
|
244
230
|
};
|
|
245
231
|
|
|
246
232
|
// ui/src/iiif/Slider.jsx
|
|
247
|
-
import
|
|
233
|
+
import React5, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
248
234
|
var Slider = (props) => {
|
|
249
235
|
const [CloverSlider, setCloverSlider] = useState3(null);
|
|
250
236
|
useEffect3(() => {
|
|
@@ -270,7 +256,7 @@ var Slider = (props) => {
|
|
|
270
256
|
} catch (_) {
|
|
271
257
|
json = "{}";
|
|
272
258
|
}
|
|
273
|
-
return /* @__PURE__ */
|
|
259
|
+
return /* @__PURE__ */ React5.createElement("div", { "data-canopy-slider": "1", className: "not-prose" }, /* @__PURE__ */ React5.createElement(
|
|
274
260
|
"script",
|
|
275
261
|
{
|
|
276
262
|
type: "application/json",
|
|
@@ -278,11 +264,11 @@ var Slider = (props) => {
|
|
|
278
264
|
}
|
|
279
265
|
));
|
|
280
266
|
}
|
|
281
|
-
return /* @__PURE__ */
|
|
267
|
+
return /* @__PURE__ */ React5.createElement(CloverSlider, { ...props });
|
|
282
268
|
};
|
|
283
269
|
|
|
284
270
|
// ui/src/iiif/MdxRelatedItems.jsx
|
|
285
|
-
import
|
|
271
|
+
import React6 from "react";
|
|
286
272
|
function MdxRelatedItems(props) {
|
|
287
273
|
let json = "{}";
|
|
288
274
|
try {
|
|
@@ -290,11 +276,11 @@ function MdxRelatedItems(props) {
|
|
|
290
276
|
} catch (_) {
|
|
291
277
|
json = "{}";
|
|
292
278
|
}
|
|
293
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ React6.createElement("div", { "data-canopy-related-items": "1", className: "not-prose" }, /* @__PURE__ */ React6.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
294
280
|
}
|
|
295
281
|
|
|
296
282
|
// ui/src/search/MdxSearchResults.jsx
|
|
297
|
-
import
|
|
283
|
+
import React7 from "react";
|
|
298
284
|
function MdxSearchResults(props) {
|
|
299
285
|
let json = "{}";
|
|
300
286
|
try {
|
|
@@ -302,11 +288,11 @@ function MdxSearchResults(props) {
|
|
|
302
288
|
} catch (_) {
|
|
303
289
|
json = "{}";
|
|
304
290
|
}
|
|
305
|
-
return /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ React7.createElement("div", { "data-canopy-search-results": "1" }, /* @__PURE__ */ React7.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
306
292
|
}
|
|
307
293
|
|
|
308
294
|
// ui/src/search/SearchSummary.jsx
|
|
309
|
-
import
|
|
295
|
+
import React8 from "react";
|
|
310
296
|
function SearchSummary(props) {
|
|
311
297
|
let json = "{}";
|
|
312
298
|
try {
|
|
@@ -314,11 +300,11 @@ function SearchSummary(props) {
|
|
|
314
300
|
} catch (_) {
|
|
315
301
|
json = "{}";
|
|
316
302
|
}
|
|
317
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ React8.createElement("div", { "data-canopy-search-summary": "1" }, /* @__PURE__ */ React8.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
318
304
|
}
|
|
319
305
|
|
|
320
306
|
// ui/src/search/MdxSearchTabs.jsx
|
|
321
|
-
import
|
|
307
|
+
import React9 from "react";
|
|
322
308
|
function MdxSearchTabs(props) {
|
|
323
309
|
let json = "{}";
|
|
324
310
|
try {
|
|
@@ -326,31 +312,31 @@ function MdxSearchTabs(props) {
|
|
|
326
312
|
} catch (_) {
|
|
327
313
|
json = "{}";
|
|
328
314
|
}
|
|
329
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ React9.createElement("div", { "data-canopy-search-tabs": "1" }, /* @__PURE__ */ React9.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
330
316
|
}
|
|
331
317
|
|
|
332
318
|
// ui/src/search/SearchResults.jsx
|
|
333
|
-
import
|
|
319
|
+
import React10 from "react";
|
|
334
320
|
function SearchResults({
|
|
335
321
|
results = [],
|
|
336
322
|
type = "all",
|
|
337
323
|
layout = "grid"
|
|
338
324
|
}) {
|
|
339
325
|
if (!results.length) {
|
|
340
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ React10.createElement("div", { className: "text-slate-600" }, /* @__PURE__ */ React10.createElement("em", null, "No results"));
|
|
341
327
|
}
|
|
342
328
|
if (layout === "list") {
|
|
343
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ React10.createElement("ul", { id: "search-results", className: "space-y-3" }, results.map((r, i) => {
|
|
344
330
|
const hasDims = Number.isFinite(Number(r.thumbnailWidth)) && Number(r.thumbnailWidth) > 0 && Number.isFinite(Number(r.thumbnailHeight)) && Number(r.thumbnailHeight) > 0;
|
|
345
331
|
const aspect = hasDims ? Number(r.thumbnailWidth) / Number(r.thumbnailHeight) : void 0;
|
|
346
|
-
return /* @__PURE__ */
|
|
332
|
+
return /* @__PURE__ */ React10.createElement(
|
|
347
333
|
"li",
|
|
348
334
|
{
|
|
349
335
|
key: i,
|
|
350
336
|
className: `search-result ${r.type}`,
|
|
351
337
|
"data-thumbnail-aspect-ratio": aspect
|
|
352
338
|
},
|
|
353
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ React10.createElement(
|
|
354
340
|
Card,
|
|
355
341
|
{
|
|
356
342
|
href: r.href,
|
|
@@ -364,17 +350,17 @@ function SearchResults({
|
|
|
364
350
|
);
|
|
365
351
|
}));
|
|
366
352
|
}
|
|
367
|
-
return /* @__PURE__ */
|
|
353
|
+
return /* @__PURE__ */ React10.createElement("div", { id: "search-results" }, /* @__PURE__ */ React10.createElement(Grid, null, results.map((r, i) => {
|
|
368
354
|
const hasDims = Number.isFinite(Number(r.thumbnailWidth)) && Number(r.thumbnailWidth) > 0 && Number.isFinite(Number(r.thumbnailHeight)) && Number(r.thumbnailHeight) > 0;
|
|
369
355
|
const aspect = hasDims ? Number(r.thumbnailWidth) / Number(r.thumbnailHeight) : void 0;
|
|
370
|
-
return /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ React10.createElement(
|
|
371
357
|
GridItem,
|
|
372
358
|
{
|
|
373
359
|
key: i,
|
|
374
360
|
className: `search-result ${r.type}`,
|
|
375
361
|
"data-thumbnail-aspect-ratio": aspect
|
|
376
362
|
},
|
|
377
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ React10.createElement(
|
|
378
364
|
Card,
|
|
379
365
|
{
|
|
380
366
|
href: r.href,
|
|
@@ -390,15 +376,15 @@ function SearchResults({
|
|
|
390
376
|
}
|
|
391
377
|
|
|
392
378
|
// ui/src/search/SearchTabs.jsx
|
|
393
|
-
import
|
|
379
|
+
import React11 from "react";
|
|
394
380
|
function SearchTabs({ type = "all", onTypeChange, types = [], counts = {} }) {
|
|
395
381
|
const orderedTypes = Array.isArray(types) ? types : [];
|
|
396
382
|
const toLabel = (t) => t && t.length ? t.charAt(0).toUpperCase() + t.slice(1) : "";
|
|
397
|
-
return /* @__PURE__ */
|
|
383
|
+
return /* @__PURE__ */ React11.createElement("div", { role: "tablist", "aria-label": "Search types", className: "flex items-center gap-2 border-b border-slate-200" }, orderedTypes.map((t) => {
|
|
398
384
|
const active = String(type).toLowerCase() === String(t).toLowerCase();
|
|
399
385
|
const cRaw = counts && Object.prototype.hasOwnProperty.call(counts, t) ? counts[t] : void 0;
|
|
400
386
|
const c = Number.isFinite(Number(cRaw)) ? Number(cRaw) : 0;
|
|
401
|
-
return /* @__PURE__ */
|
|
387
|
+
return /* @__PURE__ */ React11.createElement(
|
|
402
388
|
"button",
|
|
403
389
|
{
|
|
404
390
|
key: t,
|
|
@@ -406,7 +392,7 @@ function SearchTabs({ type = "all", onTypeChange, types = [], counts = {} }) {
|
|
|
406
392
|
"aria-selected": active,
|
|
407
393
|
type: "button",
|
|
408
394
|
onClick: () => onTypeChange && onTypeChange(t),
|
|
409
|
-
className: "px-3 py-
|
|
395
|
+
className: "px-3 py-2 text-sm rounded-t-md border-b-2 -mb-px transition-colors " + (active ? "border-brand-600 text-brand-700" : "border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300")
|
|
410
396
|
},
|
|
411
397
|
toLabel(t),
|
|
412
398
|
" (",
|
|
@@ -417,14 +403,14 @@ function SearchTabs({ type = "all", onTypeChange, types = [], counts = {} }) {
|
|
|
417
403
|
}
|
|
418
404
|
|
|
419
405
|
// ui/src/command/MdxCommandPalette.jsx
|
|
420
|
-
import
|
|
406
|
+
import React15 from "react";
|
|
421
407
|
|
|
422
408
|
// ui/src/Icons.jsx
|
|
423
|
-
import
|
|
424
|
-
var MagnifyingGlassIcon = (props) => /* @__PURE__ */
|
|
409
|
+
import React12 from "react";
|
|
410
|
+
var MagnifyingGlassIcon = (props) => /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", ...props }, /* @__PURE__ */ React12.createElement("path", { d: "M456.69 421.39L362.6 327.3a173.81 173.81 0 0034.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 00327.3 362.6l94.09 94.09a25 25 0 0035.3-35.3zM97.92 222.72a124.8 124.8 0 11124.8 124.8 124.95 124.95 0 01-124.8-124.8z" }));
|
|
425
411
|
|
|
426
412
|
// ui/src/search/SearchPanelForm.jsx
|
|
427
|
-
import
|
|
413
|
+
import React13 from "react";
|
|
428
414
|
function readBasePath() {
|
|
429
415
|
const normalize = (val) => {
|
|
430
416
|
const raw = typeof val === "string" ? val.trim() : "";
|
|
@@ -482,14 +468,42 @@ function SearchPanelForm(props = {}) {
|
|
|
482
468
|
placeholder = "Search\u2026",
|
|
483
469
|
buttonLabel = "Search",
|
|
484
470
|
label,
|
|
485
|
-
searchPath = "/search"
|
|
471
|
+
searchPath = "/search",
|
|
472
|
+
inputId: inputIdProp
|
|
486
473
|
} = props || {};
|
|
487
474
|
const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
|
|
488
|
-
const action =
|
|
475
|
+
const action = React13.useMemo(
|
|
489
476
|
() => resolveSearchPath(searchPath),
|
|
490
477
|
[searchPath]
|
|
491
478
|
);
|
|
492
|
-
|
|
479
|
+
const autoId = typeof React13.useId === "function" ? React13.useId() : void 0;
|
|
480
|
+
const [fallbackId] = React13.useState(
|
|
481
|
+
() => `canopy-cmdk-${Math.random().toString(36).slice(2, 10)}`
|
|
482
|
+
);
|
|
483
|
+
const inputId = inputIdProp || autoId || fallbackId;
|
|
484
|
+
const inputRef = React13.useRef(null);
|
|
485
|
+
const focusInput = React13.useCallback(() => {
|
|
486
|
+
const el = inputRef.current;
|
|
487
|
+
if (!el) return;
|
|
488
|
+
if (document.activeElement === el) return;
|
|
489
|
+
try {
|
|
490
|
+
el.focus({ preventScroll: true });
|
|
491
|
+
} catch (_) {
|
|
492
|
+
try {
|
|
493
|
+
el.focus();
|
|
494
|
+
} catch (_2) {
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}, []);
|
|
498
|
+
const handlePointerDown = React13.useCallback((event) => {
|
|
499
|
+
const target = event.target;
|
|
500
|
+
if (target && typeof target.closest === "function") {
|
|
501
|
+
if (target.closest("[data-canopy-command-trigger]")) return;
|
|
502
|
+
}
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
focusInput();
|
|
505
|
+
}, [focusInput]);
|
|
506
|
+
return /* @__PURE__ */ React13.createElement(
|
|
493
507
|
"form",
|
|
494
508
|
{
|
|
495
509
|
action,
|
|
@@ -497,35 +511,47 @@ function SearchPanelForm(props = {}) {
|
|
|
497
511
|
role: "search",
|
|
498
512
|
autoComplete: "off",
|
|
499
513
|
spellCheck: "false",
|
|
500
|
-
className: "group flex items-center gap-2
|
|
514
|
+
className: "group flex items-center gap-2 rounded-lg border border-slate-300 text-slate-700 shadow-sm transition w-full focus-within:ring-2 focus-within:ring-brand-500 canopy-cmdk-form",
|
|
515
|
+
onPointerDown: handlePointerDown,
|
|
516
|
+
"data-placeholder": placeholder || ""
|
|
501
517
|
},
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
|
|
504
|
-
"input",
|
|
518
|
+
/* @__PURE__ */ React13.createElement(
|
|
519
|
+
"label",
|
|
505
520
|
{
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
521
|
+
htmlFor: inputId,
|
|
522
|
+
className: "flex items-center gap-2 flex-1 min-w-0 cursor-text canopy-cmdk-label"
|
|
523
|
+
},
|
|
524
|
+
/* @__PURE__ */ React13.createElement(MagnifyingGlassIcon, { className: "w-5 h-5 text-slate-400 group-focus-within:text-brand-500 pointer-events-none" }),
|
|
525
|
+
/* @__PURE__ */ React13.createElement(
|
|
526
|
+
"input",
|
|
527
|
+
{
|
|
528
|
+
id: inputId,
|
|
529
|
+
type: "search",
|
|
530
|
+
name: "q",
|
|
531
|
+
inputMode: "search",
|
|
532
|
+
"data-canopy-command-input": true,
|
|
533
|
+
placeholder,
|
|
534
|
+
className: "flex-1 bg-transparent outline-none placeholder:text-slate-400 py-1 min-w-0",
|
|
535
|
+
"aria-label": "Search",
|
|
536
|
+
ref: inputRef
|
|
537
|
+
}
|
|
538
|
+
)
|
|
514
539
|
),
|
|
515
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ React13.createElement(
|
|
516
541
|
"button",
|
|
517
542
|
{
|
|
518
|
-
type: "
|
|
519
|
-
"data-canopy-command-
|
|
520
|
-
className: "inline-flex items-center gap-
|
|
543
|
+
type: "button",
|
|
544
|
+
"data-canopy-command-trigger": true,
|
|
545
|
+
className: "inline-flex items-center gap-2 rounded-md border border-transparent bg-brand px-2 py-1 text-sm font-medium text-white shadow-sm transition hover:bg-brand-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2"
|
|
521
546
|
},
|
|
522
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ React13.createElement("span", null, text),
|
|
548
|
+
/* @__PURE__ */ React13.createElement("span", { "aria-hidden": true, className: "hidden sm:inline-flex items-center gap-1 text-xs font-semibold canopy-cmdk-shortcut" }, /* @__PURE__ */ React13.createElement("span", null, "\u2318"), /* @__PURE__ */ React13.createElement("span", null, "K"))
|
|
523
549
|
)
|
|
524
550
|
);
|
|
525
551
|
}
|
|
526
552
|
|
|
527
553
|
// ui/src/search/SearchPanelTeaserResults.jsx
|
|
528
|
-
import
|
|
554
|
+
import React14 from "react";
|
|
529
555
|
function SearchPanelTeaserResults(props = {}) {
|
|
530
556
|
const { style } = props || {};
|
|
531
557
|
const baseStyle = {
|
|
@@ -542,7 +568,7 @@ function SearchPanelTeaserResults(props = {}) {
|
|
|
542
568
|
overflow: "auto",
|
|
543
569
|
maxHeight: "60vh"
|
|
544
570
|
};
|
|
545
|
-
return /* @__PURE__ */
|
|
571
|
+
return /* @__PURE__ */ React14.createElement("div", { "data-canopy-command-panel": true, style: { ...baseStyle, ...style || {} } }, /* @__PURE__ */ React14.createElement("div", { id: "cplist" }));
|
|
546
572
|
}
|
|
547
573
|
|
|
548
574
|
// ui/src/command/MdxCommandPalette.jsx
|
|
@@ -561,17 +587,17 @@ function MdxCommandPalette(props = {}) {
|
|
|
561
587
|
const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
|
|
562
588
|
const resolvedSearchPath = resolveSearchPath(searchPath);
|
|
563
589
|
const data = { placeholder, hotkey, maxResults, groupOrder, label: text, searchPath: resolvedSearchPath };
|
|
564
|
-
return /* @__PURE__ */
|
|
590
|
+
return /* @__PURE__ */ React15.createElement("div", { "data-canopy-command": true, className: "flex-1 min-w-0" }, /* @__PURE__ */ React15.createElement("div", { className: "relative w-full" }, /* @__PURE__ */ React15.createElement("style", null, `.relative[data-canopy-panel-auto='1']:focus-within [data-canopy-command-panel]{display:block}`), /* @__PURE__ */ React15.createElement(SearchPanelForm, { placeholder, buttonLabel, label, searchPath: resolvedSearchPath }), /* @__PURE__ */ React15.createElement(SearchPanelTeaserResults, null)), /* @__PURE__ */ React15.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: JSON.stringify(data) } }));
|
|
565
591
|
}
|
|
566
592
|
|
|
567
593
|
// ui/src/search/SearchPanel.jsx
|
|
568
|
-
import
|
|
594
|
+
import React16 from "react";
|
|
569
595
|
function SearchPanel(props = {}) {
|
|
570
596
|
const {
|
|
571
597
|
placeholder = "Search\u2026",
|
|
572
598
|
hotkey = "mod+k",
|
|
573
599
|
maxResults = 8,
|
|
574
|
-
groupOrder = ["work", "page"],
|
|
600
|
+
groupOrder = ["work", "docs", "page"],
|
|
575
601
|
// Kept for backward compat; form always renders submit
|
|
576
602
|
button = true,
|
|
577
603
|
// eslint-disable-line no-unused-vars
|
|
@@ -582,12 +608,11 @@ function SearchPanel(props = {}) {
|
|
|
582
608
|
const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
|
|
583
609
|
const resolvedSearchPath = resolveSearchPath(searchPath);
|
|
584
610
|
const data = { placeholder, hotkey, maxResults, groupOrder, label: text, searchPath: resolvedSearchPath };
|
|
585
|
-
return /* @__PURE__ */
|
|
611
|
+
return /* @__PURE__ */ React16.createElement("div", { "data-canopy-command": true, className: "flex-1 min-w-0" }, /* @__PURE__ */ React16.createElement("div", { className: "relative w-full" }, /* @__PURE__ */ React16.createElement("style", null, `.relative[data-canopy-panel-auto='1']:focus-within [data-canopy-command-panel]{display:block}`), /* @__PURE__ */ React16.createElement(SearchPanelForm, { placeholder, buttonLabel, label, searchPath: resolvedSearchPath }), /* @__PURE__ */ React16.createElement(SearchPanelTeaserResults, null)), /* @__PURE__ */ React16.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: JSON.stringify(data) } }));
|
|
586
612
|
}
|
|
587
613
|
export {
|
|
588
614
|
Card,
|
|
589
615
|
MdxCommandPalette as CommandPalette,
|
|
590
|
-
Fallback,
|
|
591
616
|
Grid,
|
|
592
617
|
GridItem,
|
|
593
618
|
HelloWorld,
|