enjanga-components-library 1.0.84 → 1.0.85

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/dist/index.js CHANGED
@@ -66,10 +66,9 @@ __export(next_exports, {
66
66
  __reExport(next_exports, navigation_star__namespace);
67
67
 
68
68
  // node_modules/@carbon/layout/es/index.js
69
- var baseFontSize = 16;
70
- function rem(px) {
71
- return "".concat(px / baseFontSize, "rem");
72
- }
69
+ var rem = (px) => {
70
+ return `${px / 16}rem`;
71
+ };
73
72
  var breakpoints = {
74
73
  sm: {
75
74
  width: rem(320)},
@@ -380,28 +379,40 @@ var renderContentfulNode = (node, key, options = {}) => {
380
379
  case richTextTypes.BLOCKS.EMBEDDED_ASSET: {
381
380
  const assetId = node.data?.target?.sys?.id || "";
382
381
  const asset = options.assets?.[assetId];
383
- if (!asset) return null;
384
- const isVideo = asset.url?.match(/\.(mp4|webm|ogg)$/i);
382
+ if (!asset?.url) return null;
383
+ const isVideo = asset.url.match(/\.(mp4|webm|ogg)$/i);
385
384
  const w = asset.width ?? 16;
386
385
  const h = asset.height ?? 9;
386
+ const caption = asset.title || asset.description;
387
+ const imageAlt = asset.description || asset.title || "";
387
388
  return /* @__PURE__ */ jsxRuntime.jsxs("figure", { children: [
388
- isVideo ? /* @__PURE__ */ jsxRuntime.jsxs(
389
- "video",
390
- {
391
- controls: true,
392
- playsInline: true,
393
- preload: "metadata",
394
- style: { maxWidth: "100%", height: "auto" },
395
- children: [
396
- /* @__PURE__ */ jsxRuntime.jsx("source", { src: asset.url, type: "video/mp4" }),
397
- "Your browser does not support the video tag."
398
- ]
399
- }
400
- ) : /* @__PURE__ */ jsxRuntime.jsx(
389
+ isVideo ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
390
+ /* @__PURE__ */ jsxRuntime.jsxs(
391
+ "video",
392
+ {
393
+ controls: true,
394
+ playsInline: true,
395
+ preload: "metadata",
396
+ style: { maxWidth: "100%", height: "auto" },
397
+ "aria-label": asset.title || "Embedded video",
398
+ "aria-describedby": asset.description ? `asset-desc-${assetId}` : void 0,
399
+ children: [
400
+ /* @__PURE__ */ jsxRuntime.jsx("source", { src: asset.url, type: "video/mp4" }),
401
+ "Your browser does not support the video tag."
402
+ ]
403
+ }
404
+ ),
405
+ asset.description && /* @__PURE__ */ jsxRuntime.jsx("p", { id: `asset-desc-${assetId}`, className: "sr-only", children: asset.description })
406
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
401
407
  "div",
402
408
  {
403
409
  className: "asset-image-wrapper",
404
- style: { aspectRatio: `${w} / ${h}`, position: "relative", width: "100%", marginBottom: "1rem" },
410
+ style: {
411
+ aspectRatio: `${w} / ${h}`,
412
+ position: "relative",
413
+ width: "100%",
414
+ marginBottom: "1rem"
415
+ },
405
416
  children: /* @__PURE__ */ jsxRuntime.jsx(
406
417
  default3__default.default,
407
418
  {
@@ -410,12 +421,12 @@ var renderContentfulNode = (node, key, options = {}) => {
410
421
  sizes: "100vw",
411
422
  style: { objectFit: "cover" },
412
423
  src: asset.url,
413
- alt: asset.title || asset.description || ""
424
+ alt: imageAlt
414
425
  }
415
426
  )
416
427
  }
417
428
  ),
418
- asset.title && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { children: asset.title })
429
+ caption && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { children: caption })
419
430
  ] }, key);
420
431
  }
421
432
  case richTextTypes.INLINES.HYPERLINK: {
package/dist/index.mjs CHANGED
@@ -39,10 +39,9 @@ __export(next_exports, {
39
39
  __reExport(next_exports, navigation_star);
40
40
 
41
41
  // node_modules/@carbon/layout/es/index.js
42
- var baseFontSize = 16;
43
- function rem(px) {
44
- return "".concat(px / baseFontSize, "rem");
45
- }
42
+ var rem = (px) => {
43
+ return `${px / 16}rem`;
44
+ };
46
45
  var breakpoints = {
47
46
  sm: {
48
47
  width: rem(320)},
@@ -353,28 +352,40 @@ var renderContentfulNode = (node, key, options = {}) => {
353
352
  case BLOCKS.EMBEDDED_ASSET: {
354
353
  const assetId = node.data?.target?.sys?.id || "";
355
354
  const asset = options.assets?.[assetId];
356
- if (!asset) return null;
357
- const isVideo = asset.url?.match(/\.(mp4|webm|ogg)$/i);
355
+ if (!asset?.url) return null;
356
+ const isVideo = asset.url.match(/\.(mp4|webm|ogg)$/i);
358
357
  const w = asset.width ?? 16;
359
358
  const h = asset.height ?? 9;
359
+ const caption = asset.title || asset.description;
360
+ const imageAlt = asset.description || asset.title || "";
360
361
  return /* @__PURE__ */ jsxs("figure", { children: [
361
- isVideo ? /* @__PURE__ */ jsxs(
362
- "video",
363
- {
364
- controls: true,
365
- playsInline: true,
366
- preload: "metadata",
367
- style: { maxWidth: "100%", height: "auto" },
368
- children: [
369
- /* @__PURE__ */ jsx("source", { src: asset.url, type: "video/mp4" }),
370
- "Your browser does not support the video tag."
371
- ]
372
- }
373
- ) : /* @__PURE__ */ jsx(
362
+ isVideo ? /* @__PURE__ */ jsxs(Fragment, { children: [
363
+ /* @__PURE__ */ jsxs(
364
+ "video",
365
+ {
366
+ controls: true,
367
+ playsInline: true,
368
+ preload: "metadata",
369
+ style: { maxWidth: "100%", height: "auto" },
370
+ "aria-label": asset.title || "Embedded video",
371
+ "aria-describedby": asset.description ? `asset-desc-${assetId}` : void 0,
372
+ children: [
373
+ /* @__PURE__ */ jsx("source", { src: asset.url, type: "video/mp4" }),
374
+ "Your browser does not support the video tag."
375
+ ]
376
+ }
377
+ ),
378
+ asset.description && /* @__PURE__ */ jsx("p", { id: `asset-desc-${assetId}`, className: "sr-only", children: asset.description })
379
+ ] }) : /* @__PURE__ */ jsx(
374
380
  "div",
375
381
  {
376
382
  className: "asset-image-wrapper",
377
- style: { aspectRatio: `${w} / ${h}`, position: "relative", width: "100%", marginBottom: "1rem" },
383
+ style: {
384
+ aspectRatio: `${w} / ${h}`,
385
+ position: "relative",
386
+ width: "100%",
387
+ marginBottom: "1rem"
388
+ },
378
389
  children: /* @__PURE__ */ jsx(
379
390
  default3,
380
391
  {
@@ -383,12 +394,12 @@ var renderContentfulNode = (node, key, options = {}) => {
383
394
  sizes: "100vw",
384
395
  style: { objectFit: "cover" },
385
396
  src: asset.url,
386
- alt: asset.title || asset.description || ""
397
+ alt: imageAlt
387
398
  }
388
399
  )
389
400
  }
390
401
  ),
391
- asset.title && /* @__PURE__ */ jsx("figcaption", { children: asset.title })
402
+ caption && /* @__PURE__ */ jsx("figcaption", { children: caption })
392
403
  ] }, key);
393
404
  }
394
405
  case INLINES.HYPERLINK: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enjanga-components-library",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "Reusable component library for Next.js 13+ projects with Carbon design system.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",