enjanga-components-library 1.0.26 → 1.0.27
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 +17 -3
- package/dist/index.mjs +17 -3
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -2055,8 +2055,9 @@ var renderContentfulNode = (node, key, options = {}) => {
|
|
|
2055
2055
|
}
|
|
2056
2056
|
case BLOCKS.HEADING_1:
|
|
2057
2057
|
case BLOCKS.HEADING_2:
|
|
2058
|
-
case BLOCKS.HEADING_3:
|
|
2059
|
-
|
|
2058
|
+
case BLOCKS.HEADING_3:
|
|
2059
|
+
case BLOCKS.HEADING_4: {
|
|
2060
|
+
const HeadingTag = node.nodeType === BLOCKS.HEADING_1 ? "h1" : node.nodeType === BLOCKS.HEADING_2 ? "h2" : node.nodeType === BLOCKS.HEADING_3 ? "h3" : "h4";
|
|
2060
2061
|
const heading = node;
|
|
2061
2062
|
return /* @__PURE__ */ jsxRuntime.jsx(HeadingTag, { children: heading.content.map(
|
|
2062
2063
|
(child, i) => renderContentfulNode(child, `${key}-h-${i}`, options)
|
|
@@ -2092,8 +2093,21 @@ var renderContentfulNode = (node, key, options = {}) => {
|
|
|
2092
2093
|
const assetId = node.data?.target?.sys?.id || "";
|
|
2093
2094
|
const asset = options.assets?.[assetId];
|
|
2094
2095
|
if (!asset) return null;
|
|
2096
|
+
const isVideo = asset.url?.match(/\.(mp4|webm|ogg)$/i);
|
|
2095
2097
|
return /* @__PURE__ */ jsxRuntime.jsxs("figure", { children: [
|
|
2096
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2098
|
+
isVideo ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2099
|
+
"video",
|
|
2100
|
+
{
|
|
2101
|
+
controls: true,
|
|
2102
|
+
playsInline: true,
|
|
2103
|
+
preload: "metadata",
|
|
2104
|
+
style: { maxWidth: "100%", height: "auto" },
|
|
2105
|
+
children: [
|
|
2106
|
+
/* @__PURE__ */ jsxRuntime.jsx("source", { src: asset.url, type: "video/mp4" }),
|
|
2107
|
+
"Your browser does not support the video tag."
|
|
2108
|
+
]
|
|
2109
|
+
}
|
|
2110
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: asset.url, alt: asset.description || asset.title }),
|
|
2097
2111
|
asset.title && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { children: asset.title })
|
|
2098
2112
|
] }, key);
|
|
2099
2113
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2027,8 +2027,9 @@ var renderContentfulNode = (node, key, options = {}) => {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
case BLOCKS.HEADING_1:
|
|
2029
2029
|
case BLOCKS.HEADING_2:
|
|
2030
|
-
case BLOCKS.HEADING_3:
|
|
2031
|
-
|
|
2030
|
+
case BLOCKS.HEADING_3:
|
|
2031
|
+
case BLOCKS.HEADING_4: {
|
|
2032
|
+
const HeadingTag = node.nodeType === BLOCKS.HEADING_1 ? "h1" : node.nodeType === BLOCKS.HEADING_2 ? "h2" : node.nodeType === BLOCKS.HEADING_3 ? "h3" : "h4";
|
|
2032
2033
|
const heading = node;
|
|
2033
2034
|
return /* @__PURE__ */ jsx(HeadingTag, { children: heading.content.map(
|
|
2034
2035
|
(child, i) => renderContentfulNode(child, `${key}-h-${i}`, options)
|
|
@@ -2064,8 +2065,21 @@ var renderContentfulNode = (node, key, options = {}) => {
|
|
|
2064
2065
|
const assetId = node.data?.target?.sys?.id || "";
|
|
2065
2066
|
const asset = options.assets?.[assetId];
|
|
2066
2067
|
if (!asset) return null;
|
|
2068
|
+
const isVideo = asset.url?.match(/\.(mp4|webm|ogg)$/i);
|
|
2067
2069
|
return /* @__PURE__ */ jsxs("figure", { children: [
|
|
2068
|
-
/* @__PURE__ */
|
|
2070
|
+
isVideo ? /* @__PURE__ */ jsxs(
|
|
2071
|
+
"video",
|
|
2072
|
+
{
|
|
2073
|
+
controls: true,
|
|
2074
|
+
playsInline: true,
|
|
2075
|
+
preload: "metadata",
|
|
2076
|
+
style: { maxWidth: "100%", height: "auto" },
|
|
2077
|
+
children: [
|
|
2078
|
+
/* @__PURE__ */ jsx("source", { src: asset.url, type: "video/mp4" }),
|
|
2079
|
+
"Your browser does not support the video tag."
|
|
2080
|
+
]
|
|
2081
|
+
}
|
|
2082
|
+
) : /* @__PURE__ */ jsx("img", { src: asset.url, alt: asset.description || asset.title }),
|
|
2069
2083
|
asset.title && /* @__PURE__ */ jsx("figcaption", { children: asset.title })
|
|
2070
2084
|
] }, key);
|
|
2071
2085
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "enjanga-components-library",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
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",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"release": "yarn clean:hard && yarn build && npm version patch && npm publish",
|
|
42
42
|
"clean": "rm -rf node_modules dist && yarn cache clean && yarn install",
|
|
43
43
|
"clean:hard": "rm -rf node_modules dist yarn.lock && yarn cache clean && yarn install",
|
|
44
|
-
"prepublishOnly": "yarn build"
|
|
44
|
+
"prepublishOnly": "yarn build",
|
|
45
|
+
"chromatic": "yarn build-storybook && chromatic --exit-zero-on-changes --project-token=chpt_7ebec659e451720"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"@carbon/react": "^1",
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"@types/react-dom": "19",
|
|
70
71
|
"@types/webpack": "^5.28.5",
|
|
71
72
|
"babel-loader": "^10.0.0",
|
|
73
|
+
"chromatic": "^13.3.0",
|
|
72
74
|
"clsx": "^2.1.1",
|
|
73
75
|
"concurrently": "^9.1.2",
|
|
74
76
|
"css-loader": "^7.1.2",
|