@canopy-iiif/app 1.5.7 → 1.5.9

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.
@@ -722,7 +722,7 @@ function Hero({
722
722
  const breadcrumbNode = isBreadcrumbVariant && breadcrumbItems.length ? /* @__PURE__ */ React9.createElement("nav", { className: "canopy-interstitial__breadcrumb", "aria-label": "Breadcrumb" }, breadcrumbItems.map((item2, idx) => {
723
723
  const isLast = idx === breadcrumbItems.length - 1;
724
724
  const key = `${item2.title || idx}-${idx}`;
725
- const content = !isLast && item2.href ? /* @__PURE__ */ React9.createElement("a", { href: item2.href }, item2.title) : /* @__PURE__ */ React9.createElement("span", { className: "canopy-interstitial__breadcrumb-current" }, item2.title);
725
+ const content = !isLast && item2.href ? /* @__PURE__ */ React9.createElement("a", { href: item2.href }, item2.title) : /* @__PURE__ */ React9.createElement("span", { className: "canopy-interstitial__breadcrumb-current", "aria-current": "page" }, item2.title);
726
726
  return /* @__PURE__ */ React9.createElement(React9.Fragment, { key }, idx > 0 ? /* @__PURE__ */ React9.createElement(
727
727
  "span",
728
728
  {
@@ -967,10 +967,14 @@ function ContentNavigation({
967
967
  }) {
968
968
  const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
969
969
  const savedDepthsRef = React11.useRef(null);
970
+ const [isExpanded, setIsExpanded] = React11.useState(false);
971
+ const handleToggle = React11.useCallback(() => {
972
+ setIsExpanded((prev) => !prev);
973
+ }, []);
970
974
  if ((!items || !items.length) && !headingId) return null;
971
975
  const combinedClassName = [
972
976
  "canopy-sub-navigation canopy-content-navigation",
973
- "canopy-content-navigation--collapsed",
977
+ isExpanded ? "canopy-content-navigation--expanded" : "canopy-content-navigation--collapsed",
974
978
  className
975
979
  ].filter(Boolean).join(" ");
976
980
  const effectiveHeading = heading || pageTitle || null;
@@ -1181,16 +1185,17 @@ function ContentNavigation({
1181
1185
  {
1182
1186
  type: "button",
1183
1187
  className: "canopy-content-navigation__toggle",
1184
- "aria-expanded": "false",
1185
- "aria-label": "Show section navigation",
1186
- title: "Show section navigation",
1188
+ "aria-expanded": isExpanded,
1189
+ "aria-label": isExpanded ? "Hide section navigation" : "Show section navigation",
1190
+ title: isExpanded ? "Hide section navigation" : "Show section navigation",
1191
+ onClick: handleToggle,
1187
1192
  "data-canopy-content-nav-toggle": "true",
1188
1193
  "data-show-label": "Show",
1189
1194
  "data-hide-label": "Hide",
1190
1195
  "data-show-full-label": "Show section navigation",
1191
1196
  "data-hide-full-label": "Hide section navigation"
1192
1197
  },
1193
- "Show"
1198
+ isExpanded ? "Hide" : "Show"
1194
1199
  ),
1195
1200
  /* @__PURE__ */ React11.createElement("ul", { className: "canopy-sub-navigation__list", role: "list" }, topLink || nestedItems)
1196
1201
  );
@@ -1415,7 +1420,7 @@ import React16 from "react";
1415
1420
 
1416
1421
  // ui/src/Icons.jsx
1417
1422
  import React13 from "react";
1418
- var MagnifyingGlassIcon = (props) => /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", ...props }, /* @__PURE__ */ React13.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" }));
1423
+ var MagnifyingGlassIcon = (props) => /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", "aria-hidden": "true", focusable: "false", ...props }, /* @__PURE__ */ React13.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" }));
1419
1424
 
1420
1425
  // ui/src/search/SearchPanelForm.jsx
1421
1426
  import React14 from "react";
@@ -1554,7 +1559,7 @@ function SearchPanelForm(props = {}) {
1554
1559
  onPointerDown: handlePointerDown,
1555
1560
  "data-has-value": hasValue ? "1" : "0"
1556
1561
  },
1557
- /* @__PURE__ */ React14.createElement("label", { htmlFor: inputId, className: "canopy-search-form__label" }, /* @__PURE__ */ React14.createElement(MagnifyingGlassIcon, { className: "canopy-search-form__icon" }), /* @__PURE__ */ React14.createElement(
1562
+ /* @__PURE__ */ React14.createElement("label", { htmlFor: inputId, className: "canopy-search-form__label" }, /* @__PURE__ */ React14.createElement(MagnifyingGlassIcon, { className: "canopy-search-form__icon" }), /* @__PURE__ */ React14.createElement("span", { className: "sr-only" }, "Search"), /* @__PURE__ */ React14.createElement(
1558
1563
  "input",
1559
1564
  {
1560
1565
  id: inputId,
@@ -1564,7 +1569,6 @@ function SearchPanelForm(props = {}) {
1564
1569
  "data-canopy-search-form-input": true,
1565
1570
  placeholder,
1566
1571
  className: "canopy-search-form__input",
1567
- "aria-label": "Search",
1568
1572
  ref: inputRef,
1569
1573
  onChange: handleInputChange,
1570
1574
  onInput: handleInputChange
@@ -2015,7 +2019,15 @@ function CanopyHeader(props = {}) {
2015
2019
  className: "canopy-nav-links canopy-header__desktop-nav",
2016
2020
  "aria-label": "Primary navigation"
2017
2021
  },
2018
- navLinks.map((link) => /* @__PURE__ */ React19.createElement("a", { key: link.href, href: link.href }, link.label || link.href))
2022
+ navLinks.map((link) => /* @__PURE__ */ React19.createElement(
2023
+ "a",
2024
+ {
2025
+ key: link.href,
2026
+ href: link.href,
2027
+ "aria-current": link.isActive ? "page" : void 0
2028
+ },
2029
+ link.label || link.href
2030
+ ))
2019
2031
  ),
2020
2032
  /* @__PURE__ */ React19.createElement("div", { className: "canopy-header__actions" }, /* @__PURE__ */ React19.createElement(
2021
2033
  "button",
@@ -2094,7 +2106,15 @@ function CanopyHeader(props = {}) {
2094
2106
  className: "canopy-nav-links canopy-modal__nav",
2095
2107
  "aria-label": "Primary navigation"
2096
2108
  },
2097
- navLinks.map((link) => /* @__PURE__ */ React19.createElement("a", { key: link.href, href: link.href }, link.label || link.href))
2109
+ navLinks.map((link) => /* @__PURE__ */ React19.createElement(
2110
+ "a",
2111
+ {
2112
+ key: link.href,
2113
+ href: link.href,
2114
+ "aria-current": link.isActive ? "page" : void 0
2115
+ },
2116
+ link.label || link.href
2117
+ ))
2098
2118
  ),
2099
2119
  hasSectionNav ? /* @__PURE__ */ React19.createElement(
2100
2120
  "nav",
@@ -2171,6 +2191,7 @@ function TeaserCard({
2171
2191
  {
2172
2192
  src: thumbnail,
2173
2193
  alt: "",
2194
+ "aria-hidden": "true",
2174
2195
  loading: "lazy",
2175
2196
  className: "canopy-search-teaser__thumb-img"
2176
2197
  }
@@ -2303,6 +2324,7 @@ function Card({
2303
2324
  {
2304
2325
  src,
2305
2326
  alt: alt || title || "",
2327
+ "aria-hidden": !alt && !title ? "true" : void 0,
2306
2328
  loading: "lazy",
2307
2329
  onLoad: () => setImageLoaded(true),
2308
2330
  onError: () => setImageLoaded(true)
@@ -2313,6 +2335,7 @@ function Card({
2313
2335
  {
2314
2336
  src,
2315
2337
  alt: alt || title || "",
2338
+ "aria-hidden": !alt && !title ? "true" : void 0,
2316
2339
  loading: "lazy",
2317
2340
  onLoad: () => setImageLoaded(true),
2318
2341
  onError: () => setImageLoaded(true),
@@ -3991,6 +4014,8 @@ function DocsCodeBlock(props = {}) {
3991
4014
  {
3992
4015
  type: "button",
3993
4016
  onClick: handleCopy,
4017
+ "aria-live": "polite",
4018
+ "aria-label": copied ? "Copied to clipboard" : "Copy code to clipboard",
3994
4019
  style: {
3995
4020
  border: "1px solid var(--color-accent-200, )",
3996
4021
  borderRadius: "6px",