@canopy-iiif/app 1.9.8 → 1.9.10
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/default-locale.js +13 -9
- package/lib/search/search-app.jsx +41 -0
- package/lib/search/search.js +6 -0
- package/package.json +1 -1
- package/ui/dist/index.mjs +77 -66
- package/ui/dist/index.mjs.map +4 -4
- package/ui/dist/server.mjs +62 -58
- package/ui/dist/server.mjs.map +4 -4
- package/ui/styles/components/_buttons.scss +1 -0
- package/ui/styles/components/header/_header.scss +8 -3
- package/ui/styles/components/header/_logo.scss +15 -0
- package/ui/styles/components/modal/_modal.scss +14 -0
- package/ui/styles/components/search/_filters.scss +9 -1
- package/ui/styles/components/search/_tabs.scss +11 -0
- package/ui/styles/index.css +48 -4
package/lib/default-locale.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated from content/locale.yml.
|
|
3
|
+
* Run `node packages/helpers/locales/sync-default-locale.js` after updating locale copy.
|
|
4
|
+
*/
|
|
1
5
|
module.exports = {
|
|
2
6
|
common: {
|
|
3
7
|
actions: {
|
|
@@ -7,7 +11,7 @@ module.exports = {
|
|
|
7
11
|
clear_all: 'Clear all',
|
|
8
12
|
done: 'Done',
|
|
9
13
|
show: 'Show',
|
|
10
|
-
hide: 'Hide'
|
|
14
|
+
hide: 'Hide'
|
|
11
15
|
},
|
|
12
16
|
nouns: {
|
|
13
17
|
search: 'Search',
|
|
@@ -27,12 +31,12 @@ module.exports = {
|
|
|
27
31
|
item_label: 'Item',
|
|
28
32
|
details: 'details',
|
|
29
33
|
breadcrumb: 'Breadcrumb',
|
|
30
|
-
home: 'Home'
|
|
34
|
+
home: 'Home'
|
|
31
35
|
},
|
|
32
36
|
types: {
|
|
33
37
|
work: 'Works',
|
|
34
38
|
page: 'Pages',
|
|
35
|
-
docs: 'Docs'
|
|
39
|
+
docs: 'Docs'
|
|
36
40
|
},
|
|
37
41
|
statuses: {
|
|
38
42
|
loading: 'Loading…',
|
|
@@ -44,7 +48,7 @@ module.exports = {
|
|
|
44
48
|
loading_content: 'Loading {content}…',
|
|
45
49
|
summary_content: 'Showing {shown} of {total} {content}',
|
|
46
50
|
search_summary: 'Found {shown} of {total} in {type} for "{query}"',
|
|
47
|
-
no_matches: 'No matches found.'
|
|
51
|
+
no_matches: 'No matches found.'
|
|
48
52
|
},
|
|
49
53
|
phrases: {
|
|
50
54
|
placeholder_search: 'Search…',
|
|
@@ -61,16 +65,16 @@ module.exports = {
|
|
|
61
65
|
scroll_direction_content: 'Scroll {direction} through {content}',
|
|
62
66
|
step_content: '{direction} {content}',
|
|
63
67
|
item_numbered: '{content} {index}',
|
|
64
|
-
content_key: '{content} key'
|
|
68
|
+
content_key: '{content} key'
|
|
65
69
|
},
|
|
66
70
|
directions: {
|
|
67
71
|
left: 'left',
|
|
68
72
|
right: 'right',
|
|
69
73
|
previous: 'Previous',
|
|
70
|
-
next: 'Next'
|
|
74
|
+
next: 'Next'
|
|
71
75
|
},
|
|
72
76
|
misc: {
|
|
73
|
-
referenced_by: 'Referenced by'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
77
|
+
referenced_by: 'Referenced by'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
76
80
|
};
|
|
@@ -6,6 +6,38 @@ import {
|
|
|
6
6
|
SearchFiltersDialog,
|
|
7
7
|
} from "@canopy-iiif/app/ui";
|
|
8
8
|
import resultTemplates from "__CANOPY_SEARCH_RESULT_TEMPLATES__";
|
|
9
|
+
const SITE_TITLE_FALLBACK = "Site title";
|
|
10
|
+
|
|
11
|
+
function readSiteTitleFromGlobals() {
|
|
12
|
+
try {
|
|
13
|
+
if (
|
|
14
|
+
typeof window !== "undefined" &&
|
|
15
|
+
typeof window.CANOPY_SITE_TITLE === "string"
|
|
16
|
+
) {
|
|
17
|
+
const raw = window.CANOPY_SITE_TITLE.trim();
|
|
18
|
+
if (raw) return raw;
|
|
19
|
+
}
|
|
20
|
+
} catch (_) {}
|
|
21
|
+
try {
|
|
22
|
+
if (
|
|
23
|
+
typeof globalThis !== "undefined" &&
|
|
24
|
+
typeof globalThis.CANOPY_SITE_TITLE === "string"
|
|
25
|
+
) {
|
|
26
|
+
const raw = globalThis.CANOPY_SITE_TITLE.trim();
|
|
27
|
+
if (raw) return raw;
|
|
28
|
+
}
|
|
29
|
+
} catch (_) {}
|
|
30
|
+
try {
|
|
31
|
+
if (typeof document !== "undefined" && document.title) {
|
|
32
|
+
const trimmed = document.title.trim();
|
|
33
|
+
if (!trimmed) return "";
|
|
34
|
+
const parts = trimmed.split("|").map((part) => part.trim()).filter(Boolean);
|
|
35
|
+
if (parts.length > 1) return parts[parts.length - 1];
|
|
36
|
+
return trimmed;
|
|
37
|
+
}
|
|
38
|
+
} catch (_) {}
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
9
41
|
|
|
10
42
|
function readBasePath() {
|
|
11
43
|
const normalize = (val) => {
|
|
@@ -60,6 +92,11 @@ function apiUrl(pathname) {
|
|
|
60
92
|
return `${base}/${cleaned}`;
|
|
61
93
|
}
|
|
62
94
|
|
|
95
|
+
function resolveSiteTitle() {
|
|
96
|
+
const title = readSiteTitleFromGlobals();
|
|
97
|
+
return title || SITE_TITLE_FALLBACK;
|
|
98
|
+
}
|
|
99
|
+
|
|
63
100
|
function readDocumentLocale() {
|
|
64
101
|
try {
|
|
65
102
|
if (
|
|
@@ -909,6 +946,8 @@ function TabsMount() {
|
|
|
909
946
|
const handleToggle = (facetSlug, valueSlug, checked) => {
|
|
910
947
|
if (toggleFilter) toggleFilter(facetSlug, valueSlug, checked);
|
|
911
948
|
};
|
|
949
|
+
const brandLabel = useMemo(() => resolveSiteTitle(), []);
|
|
950
|
+
const brandHref = useMemo(() => withBasePath("/"), []);
|
|
912
951
|
return (
|
|
913
952
|
<>
|
|
914
953
|
<SearchTabsUI
|
|
@@ -928,6 +967,8 @@ function TabsMount() {
|
|
|
928
967
|
selected={filters}
|
|
929
968
|
onToggle={handleToggle}
|
|
930
969
|
onClear={() => clearFilters && clearFilters()}
|
|
970
|
+
brandLabel={brandLabel}
|
|
971
|
+
brandHref={brandHref}
|
|
931
972
|
/>
|
|
932
973
|
) : null}
|
|
933
974
|
</>
|
package/lib/search/search.js
CHANGED
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
getLocaleRouteEntries,
|
|
17
17
|
getDefaultRoute,
|
|
18
18
|
getDefaultLocaleCode,
|
|
19
|
+
getSiteTitle,
|
|
19
20
|
} = require('../common');
|
|
20
21
|
const { resolveCanopyConfigPath } = require('../config-path');
|
|
21
22
|
|
|
@@ -310,6 +311,7 @@ async function buildSearchPageForEntry(routeEntry) {
|
|
|
310
311
|
typeof searchPageMeta.description === 'string'
|
|
311
312
|
? searchPageMeta.description
|
|
312
313
|
: '';
|
|
314
|
+
const siteTitle = typeof getSiteTitle === 'function' ? getSiteTitle() : '';
|
|
313
315
|
const pageDetails = {
|
|
314
316
|
title: pageTitle,
|
|
315
317
|
description: pageDescription,
|
|
@@ -366,6 +368,10 @@ async function buildSearchPageForEntry(routeEntry) {
|
|
|
366
368
|
}
|
|
367
369
|
}
|
|
368
370
|
let headExtra = vendorTags + head + importMap + customRuntimeTag;
|
|
371
|
+
if (siteTitle && typeof siteTitle === 'string') {
|
|
372
|
+
const siteTitleScript = `<script>window.CANOPY_SITE_TITLE=${JSON.stringify(siteTitle)}</script>`;
|
|
373
|
+
headExtra = siteTitleScript + headExtra;
|
|
374
|
+
}
|
|
369
375
|
try {
|
|
370
376
|
const { BASE_PATH } = require('../common');
|
|
371
377
|
if (BASE_PATH) {
|
package/package.json
CHANGED
package/ui/dist/index.mjs
CHANGED
|
@@ -43186,10 +43186,11 @@ function Button({
|
|
|
43186
43186
|
variant = "primary",
|
|
43187
43187
|
className = "",
|
|
43188
43188
|
children,
|
|
43189
|
+
as: Element = "a",
|
|
43189
43190
|
...rest
|
|
43190
43191
|
}) {
|
|
43191
43192
|
const resolvedVariant = VARIANTS.has(variant) ? variant : "primary";
|
|
43192
|
-
const computedRel = target === "_blank" && !rel ? "noopener noreferrer" : rel;
|
|
43193
|
+
const computedRel = Element === "a" && target === "_blank" && !rel ? "noopener noreferrer" : rel;
|
|
43193
43194
|
const content = children != null ? children : label;
|
|
43194
43195
|
if (!content) return null;
|
|
43195
43196
|
const classes = [
|
|
@@ -43197,17 +43198,19 @@ function Button({
|
|
|
43197
43198
|
`canopy-button--${resolvedVariant}`,
|
|
43198
43199
|
className
|
|
43199
43200
|
].filter(Boolean).join(" ");
|
|
43200
|
-
|
|
43201
|
-
|
|
43202
|
-
|
|
43203
|
-
|
|
43204
|
-
|
|
43205
|
-
|
|
43206
|
-
|
|
43207
|
-
|
|
43208
|
-
|
|
43209
|
-
|
|
43210
|
-
|
|
43201
|
+
const elementProps = {
|
|
43202
|
+
className: classes,
|
|
43203
|
+
...rest
|
|
43204
|
+
};
|
|
43205
|
+
if (Element === "a") {
|
|
43206
|
+
elementProps.href = href;
|
|
43207
|
+
if (target) elementProps.target = target;
|
|
43208
|
+
if (computedRel) elementProps.rel = computedRel;
|
|
43209
|
+
} else {
|
|
43210
|
+
if (typeof target !== "undefined") elementProps.target = target;
|
|
43211
|
+
if (computedRel) elementProps.rel = computedRel;
|
|
43212
|
+
}
|
|
43213
|
+
return /* @__PURE__ */ React6.createElement(Element, { ...elementProps }, content);
|
|
43211
43214
|
}
|
|
43212
43215
|
|
|
43213
43216
|
// ui/src/layout/ButtonWrapper.jsx
|
|
@@ -43449,22 +43452,40 @@ function SearchPanel(props = {}) {
|
|
|
43449
43452
|
}
|
|
43450
43453
|
|
|
43451
43454
|
// ui/src/layout/CanopyBrand.jsx
|
|
43455
|
+
import React13 from "react";
|
|
43456
|
+
|
|
43457
|
+
// ui/src/layout/pageContext.js
|
|
43452
43458
|
import React12 from "react";
|
|
43459
|
+
var CONTEXT_KEY = typeof Symbol === "function" ? Symbol.for("__CANOPY_PAGE_CONTEXT__") : "__CANOPY_PAGE_CONTEXT__";
|
|
43460
|
+
function getSharedRoot() {
|
|
43461
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
43462
|
+
if (typeof window !== "undefined") return window;
|
|
43463
|
+
if (typeof global !== "undefined") return global;
|
|
43464
|
+
return null;
|
|
43465
|
+
}
|
|
43466
|
+
function getSafePageContext() {
|
|
43467
|
+
const root2 = getSharedRoot();
|
|
43468
|
+
if (root2 && root2[CONTEXT_KEY]) return root2[CONTEXT_KEY];
|
|
43469
|
+
const ctx = React12.createContext({ navigation: null, page: null, site: null });
|
|
43470
|
+
if (root2) root2[CONTEXT_KEY] = ctx;
|
|
43471
|
+
return ctx;
|
|
43472
|
+
}
|
|
43473
|
+
|
|
43474
|
+
// ui/src/layout/CanopyBrand.jsx
|
|
43475
|
+
var PageContext = getSafePageContext();
|
|
43453
43476
|
function CanopyBrand(props = {}) {
|
|
43454
|
-
const {
|
|
43455
|
-
|
|
43456
|
-
|
|
43457
|
-
|
|
43458
|
-
|
|
43459
|
-
Logo
|
|
43460
|
-
} = props || {};
|
|
43477
|
+
const { labelId, label: labelProp, href = "/", className, Logo } = props || {};
|
|
43478
|
+
const context = React13.useContext(PageContext);
|
|
43479
|
+
const contextSiteTitle = context && context.site && typeof context.site.title === "string" ? context.site.title.trim() : "";
|
|
43480
|
+
const normalizedLabel = typeof labelProp === "string" && labelProp.trim() ? labelProp : "";
|
|
43481
|
+
const resolvedLabel = normalizedLabel || contextSiteTitle || "Site title";
|
|
43461
43482
|
const spanProps = labelId ? { id: labelId } : {};
|
|
43462
43483
|
const classes = ["canopy-logo", className].filter(Boolean).join(" ");
|
|
43463
|
-
return /* @__PURE__ */
|
|
43484
|
+
return /* @__PURE__ */ React13.createElement("a", { href, className: classes }, typeof Logo === "function" ? /* @__PURE__ */ React13.createElement(Logo, null) : null, /* @__PURE__ */ React13.createElement("span", { ...spanProps }, resolvedLabel));
|
|
43464
43485
|
}
|
|
43465
43486
|
|
|
43466
43487
|
// ui/src/layout/CanopyModal.jsx
|
|
43467
|
-
import
|
|
43488
|
+
import React14 from "react";
|
|
43468
43489
|
function CanopyModal(props = {}) {
|
|
43469
43490
|
const {
|
|
43470
43491
|
id,
|
|
@@ -43515,7 +43536,7 @@ function CanopyModal(props = {}) {
|
|
|
43515
43536
|
if (padded) bodyClasses.push("canopy-modal__body--padded");
|
|
43516
43537
|
if (bodyClassName) bodyClasses.push(bodyClassName);
|
|
43517
43538
|
const bodyClassNameValue = bodyClasses.join(" ");
|
|
43518
|
-
return /* @__PURE__ */
|
|
43539
|
+
return /* @__PURE__ */ React14.createElement("div", { ...modalProps }, /* @__PURE__ */ React14.createElement("div", { className: "canopy-modal__panel" }, /* @__PURE__ */ React14.createElement("button", { ...closeButtonProps }, /* @__PURE__ */ React14.createElement(
|
|
43519
43540
|
"svg",
|
|
43520
43541
|
{
|
|
43521
43542
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -43525,8 +43546,8 @@ function CanopyModal(props = {}) {
|
|
|
43525
43546
|
strokeWidth: "1.5",
|
|
43526
43547
|
className: "canopy-modal__close-icon"
|
|
43527
43548
|
},
|
|
43528
|
-
/* @__PURE__ */
|
|
43529
|
-
), /* @__PURE__ */
|
|
43549
|
+
/* @__PURE__ */ React14.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M6 18L18 6" })
|
|
43550
|
+
), /* @__PURE__ */ React14.createElement("span", { className: "sr-only" }, closeLabel)), /* @__PURE__ */ React14.createElement("div", { className: bodyClassNameValue }, label ? /* @__PURE__ */ React14.createElement("div", { className: "canopy-modal__brand" }, /* @__PURE__ */ React14.createElement(
|
|
43530
43551
|
CanopyBrand,
|
|
43531
43552
|
{
|
|
43532
43553
|
labelId: resolvedLabelId,
|
|
@@ -43539,7 +43560,7 @@ function CanopyModal(props = {}) {
|
|
|
43539
43560
|
}
|
|
43540
43561
|
|
|
43541
43562
|
// ui/src/layout/NavigationTree.jsx
|
|
43542
|
-
import
|
|
43563
|
+
import React15 from "react";
|
|
43543
43564
|
function normalizeDepth(depth) {
|
|
43544
43565
|
if (typeof depth !== "number") return 0;
|
|
43545
43566
|
return Math.max(0, Math.min(5, depth));
|
|
@@ -43548,7 +43569,7 @@ function NavigationTreeList({ nodes, depth, parentKey }) {
|
|
|
43548
43569
|
if (!Array.isArray(nodes) || !nodes.length) return null;
|
|
43549
43570
|
const listClasses = ["canopy-nav-tree__list"];
|
|
43550
43571
|
if (depth > 0) listClasses.push("canopy-nav-tree__list--nested");
|
|
43551
|
-
return /* @__PURE__ */
|
|
43572
|
+
return /* @__PURE__ */ React15.createElement("ul", { className: listClasses.join(" "), role: "list" }, nodes.map((node, index) => /* @__PURE__ */ React15.createElement(
|
|
43552
43573
|
NavigationTreeItem,
|
|
43553
43574
|
{
|
|
43554
43575
|
key: node.slug || node.href || node.title || `${parentKey}-${index}`,
|
|
@@ -43572,7 +43593,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43572
43593
|
const allowToggle = hasChildren && !isRootLevel;
|
|
43573
43594
|
const defaultExpanded = allowToggle ? !!node.isExpanded : true;
|
|
43574
43595
|
const toggleLabel = node.title ? `Toggle ${node.title} menu` : "Toggle section menu";
|
|
43575
|
-
return /* @__PURE__ */
|
|
43596
|
+
return /* @__PURE__ */ React15.createElement(
|
|
43576
43597
|
"li",
|
|
43577
43598
|
{
|
|
43578
43599
|
className: "canopy-nav-tree__item",
|
|
@@ -43581,7 +43602,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43581
43602
|
"data-expanded": allowToggle ? defaultExpanded ? "true" : "false" : void 0,
|
|
43582
43603
|
"data-default-expanded": allowToggle && defaultExpanded ? "true" : void 0
|
|
43583
43604
|
},
|
|
43584
|
-
/* @__PURE__ */
|
|
43605
|
+
/* @__PURE__ */ React15.createElement("div", { className: "canopy-nav-tree__row" }, /* @__PURE__ */ React15.createElement("div", { className: "canopy-nav-tree__link-wrapper" }, /* @__PURE__ */ React15.createElement(
|
|
43585
43606
|
Tag,
|
|
43586
43607
|
{
|
|
43587
43608
|
className: classes.join(" "),
|
|
@@ -43590,7 +43611,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43590
43611
|
tabIndex: isInteractive ? void 0 : -1
|
|
43591
43612
|
},
|
|
43592
43613
|
node.title || node.slug
|
|
43593
|
-
)), allowToggle ? /* @__PURE__ */
|
|
43614
|
+
)), allowToggle ? /* @__PURE__ */ React15.createElement(
|
|
43594
43615
|
"button",
|
|
43595
43616
|
{
|
|
43596
43617
|
type: "button",
|
|
@@ -43600,7 +43621,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43600
43621
|
"aria-label": toggleLabel,
|
|
43601
43622
|
"data-canopy-nav-item-toggle": panelId || void 0
|
|
43602
43623
|
},
|
|
43603
|
-
/* @__PURE__ */
|
|
43624
|
+
/* @__PURE__ */ React15.createElement(
|
|
43604
43625
|
"svg",
|
|
43605
43626
|
{
|
|
43606
43627
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -43610,7 +43631,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43610
43631
|
strokeWidth: "1.5",
|
|
43611
43632
|
className: "canopy-nav-tree__toggle-icon"
|
|
43612
43633
|
},
|
|
43613
|
-
/* @__PURE__ */
|
|
43634
|
+
/* @__PURE__ */ React15.createElement(
|
|
43614
43635
|
"path",
|
|
43615
43636
|
{
|
|
43616
43637
|
strokeLinecap: "round",
|
|
@@ -43619,9 +43640,9 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43619
43640
|
}
|
|
43620
43641
|
)
|
|
43621
43642
|
),
|
|
43622
|
-
/* @__PURE__ */
|
|
43643
|
+
/* @__PURE__ */ React15.createElement("span", { className: "sr-only" }, toggleLabel)
|
|
43623
43644
|
) : null),
|
|
43624
|
-
hasChildren ? /* @__PURE__ */
|
|
43645
|
+
hasChildren ? /* @__PURE__ */ React15.createElement(
|
|
43625
43646
|
"div",
|
|
43626
43647
|
{
|
|
43627
43648
|
id: panelId || void 0,
|
|
@@ -43629,7 +43650,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43629
43650
|
"aria-hidden": allowToggle ? defaultExpanded ? "false" : "true" : "false",
|
|
43630
43651
|
hidden: allowToggle ? !defaultExpanded : void 0
|
|
43631
43652
|
},
|
|
43632
|
-
/* @__PURE__ */
|
|
43653
|
+
/* @__PURE__ */ React15.createElement(
|
|
43633
43654
|
NavigationTreeList,
|
|
43634
43655
|
{
|
|
43635
43656
|
nodes: node.children,
|
|
@@ -43654,15 +43675,15 @@ function NavigationTree({
|
|
|
43654
43675
|
const nodes = includeRoot ? [root2] : root2.children;
|
|
43655
43676
|
if (!Array.isArray(nodes) || !nodes.length) return null;
|
|
43656
43677
|
const combinedClassName = ["canopy-nav-tree", className].filter(Boolean).join(" ");
|
|
43657
|
-
return /* @__PURE__ */
|
|
43678
|
+
return /* @__PURE__ */ React15.createElement(
|
|
43658
43679
|
Component,
|
|
43659
43680
|
{
|
|
43660
43681
|
className: combinedClassName,
|
|
43661
43682
|
"data-canopy-nav-tree": "true",
|
|
43662
43683
|
...rest
|
|
43663
43684
|
},
|
|
43664
|
-
heading ? /* @__PURE__ */
|
|
43665
|
-
/* @__PURE__ */
|
|
43685
|
+
heading ? /* @__PURE__ */ React15.createElement("div", { className: headingClassName }, heading) : null,
|
|
43686
|
+
/* @__PURE__ */ React15.createElement(
|
|
43666
43687
|
NavigationTreeList,
|
|
43667
43688
|
{
|
|
43668
43689
|
nodes,
|
|
@@ -43673,23 +43694,6 @@ function NavigationTree({
|
|
|
43673
43694
|
);
|
|
43674
43695
|
}
|
|
43675
43696
|
|
|
43676
|
-
// ui/src/layout/pageContext.js
|
|
43677
|
-
import React15 from "react";
|
|
43678
|
-
var CONTEXT_KEY = typeof Symbol === "function" ? Symbol.for("__CANOPY_PAGE_CONTEXT__") : "__CANOPY_PAGE_CONTEXT__";
|
|
43679
|
-
function getSharedRoot() {
|
|
43680
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
43681
|
-
if (typeof window !== "undefined") return window;
|
|
43682
|
-
if (typeof global !== "undefined") return global;
|
|
43683
|
-
return null;
|
|
43684
|
-
}
|
|
43685
|
-
function getSafePageContext() {
|
|
43686
|
-
const root2 = getSharedRoot();
|
|
43687
|
-
if (root2 && root2[CONTEXT_KEY]) return root2[CONTEXT_KEY];
|
|
43688
|
-
const ctx = React15.createContext({ navigation: null, page: null, site: null });
|
|
43689
|
-
if (root2) root2[CONTEXT_KEY] = ctx;
|
|
43690
|
-
return ctx;
|
|
43691
|
-
}
|
|
43692
|
-
|
|
43693
43697
|
// ui/src/layout/LanguageToggle.jsx
|
|
43694
43698
|
import React17 from "react";
|
|
43695
43699
|
|
|
@@ -44002,8 +44006,8 @@ function LanguageToggle({
|
|
|
44002
44006
|
label,
|
|
44003
44007
|
ariaLabel
|
|
44004
44008
|
}) {
|
|
44005
|
-
const
|
|
44006
|
-
const context = React17.useContext(
|
|
44009
|
+
const PageContext3 = getSafePageContext();
|
|
44010
|
+
const context = React17.useContext(PageContext3);
|
|
44007
44011
|
const siteLanguageToggle = context && context.site && context.site.languageToggle || null;
|
|
44008
44012
|
const pageData = page || (context && context.page ? context.page : null);
|
|
44009
44013
|
const resolvedToggle = languageToggle === false ? null : languageToggle === true || typeof languageToggle === "undefined" ? siteLanguageToggle : languageToggle;
|
|
@@ -44401,8 +44405,8 @@ function CanopyHeader(props = {}) {
|
|
|
44401
44405
|
logo: SiteLogo,
|
|
44402
44406
|
languageToggle: languageToggleProp
|
|
44403
44407
|
} = props;
|
|
44404
|
-
const
|
|
44405
|
-
const context = React18.useContext(
|
|
44408
|
+
const PageContext3 = getSafePageContext();
|
|
44409
|
+
const context = React18.useContext(PageContext3);
|
|
44406
44410
|
const contextPrimaryNav = context && Array.isArray(context.primaryNavigation) ? context.primaryNavigation : [];
|
|
44407
44411
|
const navLinks = navLinksProp && navLinksProp.length ? ensureArray(navLinksProp) : ensureArray(contextPrimaryNav);
|
|
44408
44412
|
const contextNavigation = context && context.navigation ? context.navigation : null;
|
|
@@ -45531,7 +45535,7 @@ function SearchTabs({
|
|
|
45531
45535
|
const orderedTypes = Array.isArray(types) ? types : [];
|
|
45532
45536
|
const toLabel = (t) => t && t.length ? t.charAt(0).toUpperCase() + t.slice(1) : "";
|
|
45533
45537
|
const hasFilters = typeof onOpenFilters === "function";
|
|
45534
|
-
const filterBadge = activeFilterCount > 0 ?
|
|
45538
|
+
const filterBadge = activeFilterCount > 0 ? /* @__PURE__ */ React34.createElement("span", { className: "canopy-search-tabs__filters-count" }, "(", activeFilterCount, ")") : null;
|
|
45535
45539
|
const [itemBoundingBox, setItemBoundingBox] = useState6(null);
|
|
45536
45540
|
const [wrapperBoundingBox, setWrapperBoundingBox] = useState6(null);
|
|
45537
45541
|
const [highlightedTab, setHighlightedTab] = useState6(null);
|
|
@@ -45611,19 +45615,23 @@ function SearchTabs({
|
|
|
45611
45615
|
);
|
|
45612
45616
|
})
|
|
45613
45617
|
), hasFilters ? /* @__PURE__ */ React34.createElement(
|
|
45614
|
-
|
|
45618
|
+
Button,
|
|
45615
45619
|
{
|
|
45620
|
+
as: "button",
|
|
45616
45621
|
type: "button",
|
|
45622
|
+
variant: "primary",
|
|
45617
45623
|
onClick: () => onOpenFilters && onOpenFilters(),
|
|
45618
45624
|
"aria-expanded": filtersOpen ? "true" : "false",
|
|
45619
|
-
className: "
|
|
45625
|
+
className: "canopy-search-tabs__filters-button"
|
|
45620
45626
|
},
|
|
45621
|
-
/* @__PURE__ */ React34.createElement("span", null, filtersLabel,
|
|
45627
|
+
/* @__PURE__ */ React34.createElement("span", null, filtersLabel),
|
|
45628
|
+
filterBadge
|
|
45622
45629
|
) : null);
|
|
45623
45630
|
}
|
|
45624
45631
|
|
|
45625
45632
|
// ui/src/search/SearchFiltersDialog.jsx
|
|
45626
45633
|
import React35 from "react";
|
|
45634
|
+
var PageContext2 = getSafePageContext();
|
|
45627
45635
|
function toArray(input) {
|
|
45628
45636
|
if (!input) return [];
|
|
45629
45637
|
if (Array.isArray(input)) return input;
|
|
@@ -45731,7 +45739,7 @@ function SearchFiltersDialog(props = {}) {
|
|
|
45731
45739
|
onClear,
|
|
45732
45740
|
title,
|
|
45733
45741
|
subtitle = "Refine results by metadata",
|
|
45734
|
-
brandLabel
|
|
45742
|
+
brandLabel: brandLabelProp,
|
|
45735
45743
|
brandHref = "/",
|
|
45736
45744
|
logo: SiteLogo
|
|
45737
45745
|
} = props;
|
|
@@ -45754,6 +45762,9 @@ function SearchFiltersDialog(props = {}) {
|
|
|
45754
45762
|
if (root2) root2.style.overflow = prevRoot;
|
|
45755
45763
|
};
|
|
45756
45764
|
}, [open]);
|
|
45765
|
+
const context = React35.useContext(PageContext2);
|
|
45766
|
+
const contextSiteTitle = context && context.site && typeof context.site.title === "string" ? context.site.title.trim() : "";
|
|
45767
|
+
const resolvedBrandLabel = typeof brandLabelProp === "string" && brandLabelProp.trim() ? brandLabelProp : contextSiteTitle || "Site title";
|
|
45757
45768
|
if (!open) return null;
|
|
45758
45769
|
const brandId = "canopy-modal-filters-label";
|
|
45759
45770
|
const subtitleText = subtitle != null ? subtitle : title;
|
|
@@ -45764,7 +45775,7 @@ function SearchFiltersDialog(props = {}) {
|
|
|
45764
45775
|
variant: "filters",
|
|
45765
45776
|
open: true,
|
|
45766
45777
|
labelledBy: brandId,
|
|
45767
|
-
label:
|
|
45778
|
+
label: resolvedBrandLabel,
|
|
45768
45779
|
logo: SiteLogo,
|
|
45769
45780
|
href: brandHref,
|
|
45770
45781
|
closeLabel: "Close filters",
|
|
@@ -47643,8 +47654,8 @@ function getReferencedModule() {
|
|
|
47643
47654
|
return referencedModule;
|
|
47644
47655
|
}
|
|
47645
47656
|
function useReferencedManifestMap() {
|
|
47646
|
-
const
|
|
47647
|
-
const pageContext = React42.useContext(
|
|
47657
|
+
const PageContext3 = getPageContext() || PageContextFallback;
|
|
47658
|
+
const pageContext = React42.useContext(PageContext3);
|
|
47648
47659
|
const referencedItems = pageContext && pageContext.page && Array.isArray(pageContext.page.referencedItems) ? pageContext.page.referencedItems : [];
|
|
47649
47660
|
return React42.useMemo(() => {
|
|
47650
47661
|
const map = /* @__PURE__ */ new Map();
|