@canopy-iiif/app 1.9.4 → 1.9.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",
package/ui/dist/index.mjs CHANGED
@@ -48269,13 +48269,40 @@ function renderPreview(props = {}) {
48269
48269
  }
48270
48270
  return /* @__PURE__ */ React43.createElement("div", { className: "canopy-gallery__placeholder", "aria-hidden": "true" });
48271
48271
  }
48272
+ function renderFlexibleContent(content, options = {}) {
48273
+ var _a2, _b;
48274
+ const {
48275
+ inlineTag: InlineTag = "span",
48276
+ blockTag: BlockTag = "div",
48277
+ className,
48278
+ id
48279
+ } = options;
48280
+ if (content == null || content === false) return null;
48281
+ const isPrimitive = typeof content === "string" || typeof content === "number" || typeof content === "bigint";
48282
+ if (isPrimitive) {
48283
+ return /* @__PURE__ */ React43.createElement(InlineTag, { className, id }, content);
48284
+ }
48285
+ if (React43.isValidElement(content)) {
48286
+ if (content.type === React43.Fragment) {
48287
+ return /* @__PURE__ */ React43.createElement(BlockTag, { className, id }, content);
48288
+ }
48289
+ const mergedClassName = [(_a2 = content.props) == null ? void 0 : _a2.className, className].filter(Boolean).join(" ");
48290
+ return React43.cloneElement(content, {
48291
+ ...content.props,
48292
+ className: mergedClassName || void 0,
48293
+ id: ((_b = content.props) == null ? void 0 : _b.id) || id
48294
+ });
48295
+ }
48296
+ const FallbackTag = BlockTag;
48297
+ return /* @__PURE__ */ React43.createElement(FallbackTag, { className, id }, content);
48298
+ }
48272
48299
  function normalizeItem(child, index, galleryId, manifestMap) {
48273
48300
  var _a2;
48274
48301
  if (!React43.isValidElement(child)) return null;
48275
48302
  if (child.type !== GalleryItem && ((_a2 = child.type) == null ? void 0 : _a2.displayName) !== "GalleryItem")
48276
48303
  return null;
48277
48304
  const props = child.props || {};
48278
- const manifestValues = Array.isArray(props.referencedManifests) ? props.referencedManifests : props.manifest ? [props.manifest] : Array.isArray(props.manifests) ? props.manifests : [];
48305
+ const manifestValues = props.referencedManifests ? ensureArray4(props.referencedManifests) : props.manifest ? [props.manifest] : props.manifests ? ensureArray4(props.manifests) : [];
48279
48306
  const manifests = resolveReferencedManifests(manifestValues, manifestMap);
48280
48307
  const normalizedProps = { ...props };
48281
48308
  if (!normalizedProps.title) {
@@ -48346,7 +48373,11 @@ function buildCaptionContent(itemProps) {
48346
48373
  if (itemProps.caption) return itemProps.caption;
48347
48374
  const kicker = itemProps.kicker || itemProps.label || itemProps.eyebrow;
48348
48375
  const summary = itemProps.summary || itemProps.description;
48349
- return /* @__PURE__ */ React43.createElement(React43.Fragment, null, kicker ? /* @__PURE__ */ React43.createElement("span", { className: "canopy-gallery__kicker" }, kicker) : null, itemProps.title ? /* @__PURE__ */ React43.createElement("span", { className: "canopy-gallery__title-text" }, itemProps.title) : null, summary ? /* @__PURE__ */ React43.createElement("span", { className: "canopy-gallery__summary" }, summary) : null, renderMetaList(
48376
+ return /* @__PURE__ */ React43.createElement(React43.Fragment, null, kicker ? /* @__PURE__ */ React43.createElement("span", { className: "canopy-gallery__kicker" }, kicker) : null, itemProps.title ? /* @__PURE__ */ React43.createElement("span", { className: "canopy-gallery__title-text" }, itemProps.title) : null, renderFlexibleContent(summary, {
48377
+ inlineTag: "span",
48378
+ blockTag: "div",
48379
+ className: "canopy-gallery__summary"
48380
+ }), renderMetaList(
48350
48381
  itemProps.meta,
48351
48382
  "canopy-gallery__meta canopy-gallery__meta--caption"
48352
48383
  ));
@@ -48428,14 +48459,12 @@ function GalleryModal({ item, closeTargetId, navItems, navGroupName }) {
48428
48459
  ">"
48429
48460
  ),
48430
48461
  /* @__PURE__ */ React43.createElement("span", { className: "canopy-gallery__visually-hidden" }, "Next item")
48431
- ), /* @__PURE__ */ React43.createElement("header", { className: "canopy-gallery__modal-header" }, /* @__PURE__ */ React43.createElement("div", { className: "canopy-gallery__modal-text" }, kicker ? /* @__PURE__ */ React43.createElement("p", { className: "canopy-gallery__modal-kicker" }, kicker) : null, /* @__PURE__ */ React43.createElement("h3", { id: modalTitleId, className: "canopy-gallery__modal-title" }, modalTitle), summary ? /* @__PURE__ */ React43.createElement(
48432
- "p",
48433
- {
48434
- id: modalDescriptionId || void 0,
48435
- className: "canopy-gallery__modal-summary"
48436
- },
48437
- summary
48438
- ) : null, renderMetaList(
48462
+ ), /* @__PURE__ */ React43.createElement("header", { className: "canopy-gallery__modal-header" }, /* @__PURE__ */ React43.createElement("div", { className: "canopy-gallery__modal-text" }, kicker ? /* @__PURE__ */ React43.createElement("p", { className: "canopy-gallery__modal-kicker" }, kicker) : null, /* @__PURE__ */ React43.createElement("h3", { id: modalTitleId, className: "canopy-gallery__modal-title" }, modalTitle), renderFlexibleContent(summary, {
48463
+ inlineTag: "p",
48464
+ blockTag: "div",
48465
+ className: "canopy-gallery__modal-summary",
48466
+ id: modalDescriptionId || void 0
48467
+ }), renderMetaList(
48439
48468
  props.meta,
48440
48469
  "canopy-gallery__meta canopy-gallery__meta--modal"
48441
48470
  ), manifests && manifests.length ? manifests.map((manifest) => /* @__PURE__ */ React43.createElement("a", { key: manifest.id || manifest.href, href: manifest.href }, manifest.title || manifest.href)) : null)), /* @__PURE__ */ React43.createElement("div", { className: "canopy-gallery__modal-body" }, props.children)))