@storyblok/react 7.1.0 → 7.2.1

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/README.md CHANGED
@@ -233,24 +233,27 @@ export async function fetchData() {
233
233
 
234
234
  | Export | Use Case | Live Editing | Static Export Support |
235
235
  | ---------------------- | ----------------------------------- | ------------ | --------------------- |
236
- | `@storyblok/react` | Client-side rendering, SPA | ✅ | ✅ |
237
- | `@storyblok/react/ssr` | Server-side rendering, static sites | ❌ | ✅ |
238
- | `@storyblok/react/rsc` | React Server Components | ✅ | ❌ |
236
+ | `@storyblok/react` | Client-side rendering, SPA | ✅ | ✅ |
237
+ | `@storyblok/react/ssr` | Server-side rendering, static sites | ❌ | ✅ |
238
+ | `@storyblok/react/rsc` | React Server Components | ✅ | ❌ |
239
239
 
240
240
  ### When to Use Each Export
241
241
 
242
242
  **Use `@storyblok/react`** for:
243
+
243
244
  - Single Page Applications (SPA)
244
245
  - Client-side rendered React apps
245
246
  - When you need live editing in browser-based applications
246
247
 
247
248
  **Use `@storyblok/react/ssr`** for:
249
+
248
250
  - Next.js static exports (`output: 'export'`)
249
251
  - Static site generation without live editing
250
252
  - Server-side rendering where live editing isn't required
251
253
  - Performance-critical scenarios where bundle size matters
252
254
 
253
255
  **Use `@storyblok/react/rsc`** for:
256
+
254
257
  - Next.js App Router with React Server Components
255
258
  - When you need live editing with server components
256
259
  - Modern React applications with server/client component separation
@@ -265,7 +268,7 @@ If you're using Next.js with `output: 'export'` for static site generation, you
265
268
  // next.config.js
266
269
  /** @type {import('next').NextConfig} */
267
270
  const nextConfig = {
268
- output: 'export', // Enables static export
271
+ output: "export", // Enables static export
269
272
  };
270
273
 
271
274
  module.exports = nextConfig;
@@ -306,7 +309,7 @@ export default async function Home() {
306
309
 
307
310
  export async function fetchData() {
308
311
  const storyblokApi = getStoryblokApi();
309
- return storyblokApi.get(`cdn/stories/home`, { version: 'draft' });
312
+ return storyblokApi.get(`cdn/stories/home`, { version: "draft" });
310
313
  }
311
314
  ```
312
315
 
@@ -386,6 +389,7 @@ export async function fetchData() {
386
389
  ```
387
390
 
388
391
  **The `StoryblokStory` component automatically:**
392
+
389
393
  - Renders your Storyblok content components on the server
390
394
  - Loads the bridge script for live editing (when in Visual Editor)
391
395
  - Handles live content updates via global cache
@@ -396,9 +400,9 @@ export async function fetchData() {
396
400
  You can pass bridge options for advanced configurations:
397
401
 
398
402
  ```jsx
399
- const bridgeOptions = { resolveRelations: ['article.author'] };
403
+ const bridgeOptions = { resolveRelations: ["article.author"] };
400
404
 
401
- <StoryblokStory story={data.story} bridgeOptions={bridgeOptions} />
405
+ <StoryblokStory story={data.story} bridgeOptions={bridgeOptions} />;
402
406
  ```
403
407
 
404
408
  **Advanced: Manual Component Separation**
@@ -421,6 +425,7 @@ import { StoryblokServerComponent, StoryblokLiveEditing } from '@storyblok/react
421
425
  When creating your individual Storyblok content components (like `Page`, `Teaser`, etc.), you must use `StoryblokServerComponent` for nested components. Import it from the same export you're using:
422
426
 
423
427
  **For RSC (with live editing):**
428
+
424
429
  ```jsx
425
430
  import {
426
431
  storyblokEditable,
@@ -439,6 +444,7 @@ export default Page;
439
444
  ```
440
445
 
441
446
  **For SSR (static exports):**
447
+
442
448
  ```jsx
443
449
  import {
444
450
  storyblokEditable,
@@ -698,10 +704,18 @@ For a comprehensive list of options you can provide to the `useStoryblokRichText
698
704
  You can override the default resolvers by passing a `resolvers` prop to the `StoryblokRichText` component, for example, to use NextJS Link component or add a custom codeblok component:
699
705
 
700
706
  ```ts
701
- import { StoryblokRichText, useStoryblok, MarkTypes, type StoryblokRichTextNode } from '@storyblok/react';
707
+ import { StoryblokRichText, useStoryblok, MarkTypes, type SbReactRichTextComponentMap, type SbReactRichTextProps } from '@storyblok/react';
702
708
  import Link from 'next/link';
703
709
  import CodeBlock from './components/CodeBlock';
704
710
 
711
+ function CustomLink({ children, attrs }: SbReactRichTextProps<"link">) {
712
+ return (
713
+ <Link href={attrs?.href ?? ""} target={attrs?.target ?? "_self"}>
714
+ {children}
715
+ </Link>
716
+ );
717
+ }
718
+
705
719
  function App() {
706
720
  const story = useStoryblok('home', { version: 'draft' });
707
721
 
@@ -709,40 +723,16 @@ function App() {
709
723
  return <div>Loading...</div>;
710
724
  }
711
725
 
712
- const resolvers = {
713
- [MarkTypes.LINK]: (node: StoryblokRichTextNode<ReactElement>) => {
714
- return node.attrs?.linktype === 'story'
715
- ? (
716
- <Link
717
- href={node.attrs?.href}
718
- target={node.attrs?.target}
719
- >
720
- {node.text}
721
- </Link>
722
- )
723
- : (
724
- <a
725
- href={node.attrs?.href}
726
- target={node.attrs?.target}
727
- >
728
- {node.text}
729
- </a>
730
- );
731
- },
732
- [BlockTypes.CODE_BLOCK]: (node) =>
733
- <CodeBlock
734
- class={node?.attrs?.class}
735
- >
736
- {node.children}
737
- </CodeBlock>;
738
- }
726
+ const components: SbReactRichTextComponentMap = {
727
+ heading: CustomHeading,
728
+ link: CustomLink,
729
+ table: CustomTable,
730
+ bold: ({ children }) => <b className="font-bold text-black">{children}</b>,
731
+ };
739
732
 
740
733
  return (
741
734
  <div>
742
- <StoryblokRichText
743
- doc={story.content.richText}
744
- resolvers={resolvers}
745
- />
735
+ <StoryblokRichText document={blok.richtext_field} components={components} />
746
736
  </div>
747
737
  );
748
738
  }
@@ -867,6 +857,7 @@ By using these techniques, you can ensure that only the necessary components and
867
857
  ### "Server Actions are not supported with static export"
868
858
 
869
859
  **Error:** When using Next.js with `output: 'export'`, you might encounter:
860
+
870
861
  ```
871
862
  Error: Server Actions are not supported with static export
872
863
  ```
@@ -901,8 +892,8 @@ Error: Server Actions are not supported with static export
901
892
  ```js
902
893
  storyblokInit({
903
894
  components: {
904
- page: Page, // Matches 'page' component in Storyblok
905
- teaser: Teaser, // Matches 'teaser' component in Storyblok
895
+ page: Page, // Matches 'page' component in Storyblok
896
+ teaser: Teaser, // Matches 'teaser' component in Storyblok
906
897
  // Add all your components here
907
898
  },
908
899
  });
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),s=require("./rich-text-renderer.js");require("@storyblok/richtext");const a=require("./create-default-blok.js");function d(t){const r=a.createDefaultBlok(t);return function({document:n,optimizeImage:o,components:c,wrapper:i=!0,...u}){const e=s.createRichTextRenderer({optimizeImage:o,components:{blok:r,...c}})(n);return i?l.jsx("div",{...u,children:e}):e}}exports.createStoryblokRichText=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./rich-text-renderer.js");require("@storyblok/richtext");const d=require("./create-default-blok.js");function f(t){const r=d.createDefaultBlok(t);return function({document:n,optimizeImage:o,components:c,data:i,wrapper:u=!0,...l}){const e=a.createRichTextRenderer({optimizeImage:o,components:{blok:r,...c},data:i})(n);return u?s.jsx("div",{...l,children:e}):e}}exports.createStoryblokRichText=f;
@@ -1,26 +1,28 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { createRichTextRenderer as m } from "./rich-text-renderer.mjs";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { createRichTextRenderer as u } from "./rich-text-renderer.mjs";
3
3
  import "@storyblok/richtext";
4
- import { createDefaultBlok as u } from "./create-default-blok.mjs";
5
- function h(t) {
6
- const e = u(t);
4
+ import { createDefaultBlok as p } from "./create-default-blok.mjs";
5
+ function R(t) {
6
+ const e = p(t);
7
7
  return function({
8
8
  document: o,
9
9
  optimizeImage: n,
10
10
  components: c,
11
- wrapper: i = !0,
12
- ...f
11
+ data: i,
12
+ wrapper: f = !0,
13
+ ...l
13
14
  }) {
14
- const r = m({
15
+ const r = u({
15
16
  optimizeImage: n,
16
17
  components: {
17
18
  blok: e,
18
19
  ...c
19
- }
20
+ },
21
+ data: i
20
22
  })(o);
21
- return i ? /* @__PURE__ */ l("div", { ...f, children: r }) : r;
23
+ return f ? /* @__PURE__ */ m("div", { ...l, children: r }) : r;
22
24
  };
23
25
  }
24
26
  export {
25
- h as createStoryblokRichText
27
+ R as createStoryblokRichText
26
28
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),i=require("@storyblok/richtext"),o=require("react");function y(t,e){return e==null?void 0:e[t]}const p={class:"className"};function C(t){return function(c){const r=i.normalizeNodes(c,!0);return r!=null&&r.length?g(r,t):null}}function g(t,e){return i.groupLinkNodes(t).map((r,n)=>r.linkMark?T(r.nodes,r.linkMark,e,r._key||n):x(r.nodes[0],e,r._key||n))}function T(t,e,c,r){const n=t.map((l,a)=>{const m=l,h=i.getInnerMarks(l);return b(m,h,c,l._key||a)}),s=y(e.type,c.components);if(s)return f.jsx(s,{...e,children:n},r);const u=i.resolveTag(e);return u?o.createElement(u,{key:r,...i.processAttrs(e.type,e.attrs,p)},n):f.jsx(o.Fragment,{children:n},r)}function x(t,e,c){if(t.type==="text")return A(t,e,c);const r=y(t.type,e.components);if(r)return f.jsx(r,{...t,context:e,children:t.content?g(t.content,e):null},c);const n=i.resolveTag(t);if(!n)return t.content?g(t.content,e):null;if(t.type==="image"&&e.optimizeImage)return R(t,e,c);const s=i.processAttrs(t.type,t.attrs,p);if(i.isSelfClosing(n))return o.createElement(n,{key:c,...s});if(t.type==="table")return S(t,e,c,n,s);const u=i.getStaticChildren(t);if(u){const l=t.content?g(t.content,e):null,a=d(t.type,u,t.attrs,l);return o.createElement(n,{key:c},a)}return o.createElement(n,{key:c,...s},t.content?g(t.content,e):null)}function R(t,e,c){const r=t.attrs,n=r==null?void 0:r.src;if(!n)return null;const{src:s,attrs:u}=i.buildStoryblokImage(n,e.optimizeImage),l=i.processAttrs("image",{...r,src:s,...u},p);return f.jsx("img",{...l},c)}function S(t,e,c,r,n){const{headerRows:s,bodyRows:u}=i.splitTableRows(t.content),l=[];return s.length>0&&l.push(f.jsx("thead",{children:s.map((a,m)=>x(a,e,a._key||m))},"thead")),u.length>0&&l.push(f.jsx("tbody",{children:u.map((a,m)=>x(a,e,a._key||m))},"tbody")),o.createElement(r,{key:c,...n},l)}function d(t,e,c,r){return e.map((n,s)=>{const{tag:u,children:l,attrs:a}=n,m={...a,...c},h=i.processAttrs(t,m,p);if(i.isSelfClosing(u))return o.createElement(u,{key:s,...h});const j=l?d(t,l,c,r):r;return o.createElement(u,{key:s,...h},j)})}function A(t,e,c){return b(t,t.marks,e,c)}function b(t,e,c,r){let n=t.text;if(e!=null&&e.length)for(const s of e)n=E(n,s,c);return f.jsx(o.Fragment,{children:n},r)}function E(t,e,c){const r=y(e.type,c.components);if(r)return f.jsx(r,{...e,children:t});const n=i.resolveTag(e);if(!n)return t;const s=i.processAttrs(e.type,e.attrs,p);return o.createElement(n,s,t)}exports.createRichTextRenderer=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),u=require("@storyblok/richtext"),f=require("react");function y(t,e){return e==null?void 0:e[t]}const x={class:"className"};function j(t){return function(n){const r=u.normalizeNodes(n,!0);return r!=null&&r.length?p(r,t):null}}function p(t,e){return u.groupLinkNodes(t).map((r,c)=>r.linkMark?T(r.nodes,r.linkMark,e,r._key||c):h(r.nodes[0],e,r._key||c))}function T(t,e,n,r){const c=t.map((l,a)=>{const o=l,g=u.getInnerMarks(l);return d(o,g,n,l._key||a)}),s=y(e.type,n.components);if(s)return m.jsx(s,{...e,context:n,children:c},r);const i=u.resolveTag(e);return i?f.createElement(i,{key:r,...u.processAttrs(e.type,e.attrs,x)},c):m.jsx(f.Fragment,{children:c},r)}function h(t,e,n){var a;const r=t.type!=="text"&&t.content?p(t.content,e):null,c=y(t.type,e.components);if(c){const o=(a=e.components)!=null&&a[t.type]?{...e,components:{...e.components,[t.type]:void 0}}:e;return m.jsx(c,{...t,context:o,children:r},n)}if(t.type==="text")return A(t,e,n);const s=u.resolveTag(t);if(!s)return t.content?p(t.content,e):null;if(t.type==="image"&&e.optimizeImage)return R(t,e,n);const i=u.processAttrs(t.type,t.attrs,x);if(u.isSelfClosing(s))return f.createElement(s,{key:n,...i});if(t.type==="table")return S(t,e,n,s,i);const l=u.getStaticChildren(t);if(l){const o=t.content?p(t.content,e):null,g=b(t.type,l,t.attrs,o);return f.createElement(s,{key:n},g)}return f.createElement(s,{key:n,...i},t.content?p(t.content,e):null)}function R(t,e,n){const r=t.attrs,c=r==null?void 0:r.src;if(!c)return null;const{src:s,attrs:i}=u.buildStoryblokImage(c,e.optimizeImage),l=u.processAttrs("image",{...r,src:s,...i},x);return m.jsx("img",{...l},n)}function S(t,e,n,r,c){const{headerRows:s,bodyRows:i}=u.splitTableRows(t.content),l=[];return s.length>0&&l.push(m.jsx("thead",{children:s.map((a,o)=>h(a,e,a._key||o))},"thead")),i.length>0&&l.push(m.jsx("tbody",{children:i.map((a,o)=>h(a,e,a._key||o))},"tbody")),f.createElement(r,{key:n,...c},l)}function b(t,e,n,r){return e.map((c,s)=>{const{tag:i,children:l,attrs:a}=c,o={...a,...n},g=u.processAttrs(t,o,x);if(u.isSelfClosing(i))return f.createElement(i,{key:s,...g});const C=l?b(t,l,n,r):r;return f.createElement(i,{key:s,...g},C)})}function A(t,e,n){return d(t,t.marks,e,n)}function d(t,e,n,r){let c=t.text;if(e!=null&&e.length)for(const s of e)c=E(c,s,n);return m.jsx(f.Fragment,{children:c},r)}function E(t,e,n){const r=y(e.type,n.components);if(r)return m.jsx(r,{...e,context:n,children:t});const c=u.resolveTag(e);if(!c)return t;const s=u.processAttrs(e.type,e.attrs,x);return f.createElement(c,s,t)}exports.createRichTextRenderer=j;
@@ -1,105 +1,108 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { normalizeNodes as R, groupLinkNodes as S, getInnerMarks as T, resolveTag as d, processAttrs as p, isSelfClosing as x, getStaticChildren as z, buildStoryblokImage as _, splitTableRows as A } from "@storyblok/richtext";
3
- import a from "react";
4
- function b(t, e) {
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { normalizeNodes as R, groupLinkNodes as S, getInnerMarks as T, resolveTag as x, processAttrs as g, isSelfClosing as b, getStaticChildren as z, buildStoryblokImage as _, splitTableRows as A } from "@storyblok/richtext";
3
+ import o from "react";
4
+ function C(t, e) {
5
5
  return e == null ? void 0 : e[t];
6
6
  }
7
- const g = {
7
+ const h = {
8
8
  class: "className"
9
9
  };
10
10
  function O(t) {
11
- return function(c) {
12
- const r = R(c, !0);
13
- return r != null && r.length ? m(r, t) : null;
11
+ return function(n) {
12
+ const r = R(n, !0);
13
+ return r != null && r.length ? p(r, t) : null;
14
14
  };
15
15
  }
16
- function m(t, e) {
17
- return S(t).map((r, n) => r.linkMark ? I(r.nodes, r.linkMark, e, r._key || n) : y(r.nodes[0], e, r._key || n));
16
+ function p(t, e) {
17
+ return S(t).map((r, c) => r.linkMark ? I(r.nodes, r.linkMark, e, r._key || c) : y(r.nodes[0], e, r._key || c));
18
18
  }
19
- function I(t, e, c, r) {
20
- const n = t.map((i, l) => {
21
- const f = i, h = T(i);
22
- return E(f, h, c, i._key || l);
23
- }), s = b(e.type, c.components);
19
+ function I(t, e, n, r) {
20
+ const c = t.map((i, l) => {
21
+ const a = i, m = T(i);
22
+ return E(a, m, n, i._key || l);
23
+ }), s = C(e.type, n.components);
24
24
  if (s)
25
- return /* @__PURE__ */ o(s, { ...e, children: n }, r);
26
- const u = d(e);
27
- return u ? a.createElement(u, { key: r, ...p(e.type, e.attrs, g) }, n) : /* @__PURE__ */ o(a.Fragment, { children: n }, r);
25
+ return /* @__PURE__ */ f(s, { ...e, context: n, children: c }, r);
26
+ const u = x(e);
27
+ return u ? o.createElement(u, { key: r, ...g(e.type, e.attrs, h) }, c) : /* @__PURE__ */ f(o.Fragment, { children: c }, r);
28
28
  }
29
- function y(t, e, c) {
29
+ function y(t, e, n) {
30
+ var l;
31
+ const r = t.type !== "text" && t.content ? p(t.content, e) : null, c = C(t.type, e.components);
32
+ if (c) {
33
+ const a = (l = e.components) != null && l[t.type] ? { ...e, components: { ...e.components, [t.type]: void 0 } } : e;
34
+ return /* @__PURE__ */ f(c, { ...t, context: a, children: r }, n);
35
+ }
30
36
  if (t.type === "text")
31
- return w(t, e, c);
32
- const r = b(t.type, e.components);
33
- if (r)
34
- return /* @__PURE__ */ o(r, { ...t, context: e, children: t.content ? m(t.content, e) : null }, c);
35
- const n = d(t);
36
- if (!n)
37
- return t.content ? m(t.content, e) : null;
37
+ return M(t, e, n);
38
+ const s = x(t);
39
+ if (!s)
40
+ return t.content ? p(t.content, e) : null;
38
41
  if (t.type === "image" && e.optimizeImage)
39
- return M(t, e, c);
40
- const s = p(t.type, t.attrs, g);
41
- if (x(n))
42
- return a.createElement(n, { key: c, ...s });
42
+ return v(t, e, n);
43
+ const u = g(t.type, t.attrs, h);
44
+ if (b(s))
45
+ return o.createElement(s, { key: n, ...u });
43
46
  if (t.type === "table")
44
- return v(t, e, c, n, s);
45
- const u = z(t);
46
- if (u) {
47
- const i = t.content ? m(t.content, e) : null, l = C(t.type, u, t.attrs, i);
48
- return a.createElement(n, { key: c }, l);
47
+ return F(t, e, n, s, u);
48
+ const i = z(t);
49
+ if (i) {
50
+ const a = t.content ? p(t.content, e) : null, m = d(t.type, i, t.attrs, a);
51
+ return o.createElement(s, { key: n }, m);
49
52
  }
50
- return a.createElement(
51
- n,
52
- { key: c, ...s },
53
- t.content ? m(t.content, e) : null
53
+ return o.createElement(
54
+ s,
55
+ { key: n, ...u },
56
+ t.content ? p(t.content, e) : null
54
57
  );
55
58
  }
56
- function M(t, e, c) {
57
- const r = t.attrs, n = r == null ? void 0 : r.src;
58
- if (!n)
59
+ function v(t, e, n) {
60
+ const r = t.attrs, c = r == null ? void 0 : r.src;
61
+ if (!c)
59
62
  return null;
60
- const { src: s, attrs: u } = _(n, e.optimizeImage), i = p("image", {
63
+ const { src: s, attrs: u } = _(c, e.optimizeImage), i = g("image", {
61
64
  ...r,
62
65
  src: s,
63
66
  ...u
64
- }, g);
65
- return /* @__PURE__ */ o("img", { ...i }, c);
67
+ }, h);
68
+ return /* @__PURE__ */ f("img", { ...i }, n);
66
69
  }
67
- function v(t, e, c, r, n) {
70
+ function F(t, e, n, r, c) {
68
71
  const { headerRows: s, bodyRows: u } = A(t.content), i = [];
69
72
  return s.length > 0 && i.push(
70
- /* @__PURE__ */ o("thead", { children: s.map((l, f) => y(l, e, l._key || f)) }, "thead")
73
+ /* @__PURE__ */ f("thead", { children: s.map((l, a) => y(l, e, l._key || a)) }, "thead")
71
74
  ), u.length > 0 && i.push(
72
- /* @__PURE__ */ o("tbody", { children: u.map((l, f) => y(l, e, l._key || f)) }, "tbody")
73
- ), a.createElement(r, { key: c, ...n }, i);
75
+ /* @__PURE__ */ f("tbody", { children: u.map((l, a) => y(l, e, l._key || a)) }, "tbody")
76
+ ), o.createElement(r, { key: n, ...c }, i);
74
77
  }
75
- function C(t, e, c, r) {
76
- return e.map((n, s) => {
77
- const { tag: u, children: i, attrs: l } = n, f = { ...l, ...c }, h = p(t, f, g);
78
- if (x(u))
79
- return a.createElement(u, { key: s, ...h });
80
- const N = i ? C(t, i, c, r) : r;
81
- return a.createElement(u, { key: s, ...h }, N);
78
+ function d(t, e, n, r) {
79
+ return e.map((c, s) => {
80
+ const { tag: u, children: i, attrs: l } = c, a = { ...l, ...n }, m = g(t, a, h);
81
+ if (b(u))
82
+ return o.createElement(u, { key: s, ...m });
83
+ const N = i ? d(t, i, n, r) : r;
84
+ return o.createElement(u, { key: s, ...m }, N);
82
85
  });
83
86
  }
84
- function w(t, e, c) {
85
- return E(t, t.marks, e, c);
87
+ function M(t, e, n) {
88
+ return E(t, t.marks, e, n);
86
89
  }
87
- function E(t, e, c, r) {
88
- let n = t.text;
90
+ function E(t, e, n, r) {
91
+ let c = t.text;
89
92
  if (e != null && e.length)
90
93
  for (const s of e)
91
- n = F(n, s, c);
92
- return /* @__PURE__ */ o(a.Fragment, { children: n }, r);
94
+ c = w(c, s, n);
95
+ return /* @__PURE__ */ f(o.Fragment, { children: c }, r);
93
96
  }
94
- function F(t, e, c) {
95
- const r = b(e.type, c.components);
97
+ function w(t, e, n) {
98
+ const r = C(e.type, n.components);
96
99
  if (r)
97
- return /* @__PURE__ */ o(r, { ...e, children: t });
98
- const n = d(e);
99
- if (!n)
100
+ return /* @__PURE__ */ f(r, { ...e, context: n, children: t });
101
+ const c = x(e);
102
+ if (!c)
100
103
  return t;
101
- const s = p(e.type, e.attrs, g);
102
- return a.createElement(n, s, t);
104
+ const s = g(e.type, e.attrs, h);
105
+ return o.createElement(c, s, t);
103
106
  }
104
107
  export {
105
108
  O as createRichTextRenderer
package/dist/index.d.ts CHANGED
@@ -155,6 +155,7 @@ export declare type SbReactRichTextProps<T extends SbRichTextElement> = SbRichTe
155
155
  export declare interface SbReactRichTextRenderContext {
156
156
  optimizeImage?: boolean | SbRichTextImageOptions;
157
157
  components?: SbReactRichTextComponentMap;
158
+ data?: unknown;
158
159
  }
159
160
 
160
161
  export declare interface SbReactSDKOptions extends SbSDKOptions {
@@ -203,7 +204,7 @@ export { storyblokEditable }
203
204
 
204
205
  export declare const storyblokInit: (pluginOptions?: SbReactSDKOptions) => (() => StoryblokClient);
205
206
 
206
- export declare const StoryblokRichText: ({ document, optimizeImage, components, wrapper, ...rest }: SbRichTextProps_2) => ReactNode;
207
+ export declare const StoryblokRichText: ({ document, optimizeImage, components, data, wrapper, ...rest }: SbRichTextProps_2) => ReactNode;
207
208
 
208
209
  export declare interface StoryblokRichTextProps extends SbReactRichTextRenderContext {
209
210
  optimizeImage?: boolean | SbRichTextImageOptions;
package/dist/rsc.d.ts CHANGED
@@ -125,6 +125,7 @@ export declare type SbReactRichTextProps<T extends SbRichTextElement> = SbRichTe
125
125
  export declare interface SbReactRichTextRenderContext {
126
126
  optimizeImage?: boolean | SbRichTextImageOptions;
127
127
  components?: SbReactRichTextComponentMap;
128
+ data?: unknown;
128
129
  }
129
130
 
130
131
  export declare interface SbReactSDKOptions extends SbSDKOptions {
@@ -183,7 +184,7 @@ export declare interface StoryblokRichTextProps extends SbReactRichTextRenderCon
183
184
 
184
185
  export declare const StoryblokServerComponent: ForwardRefExoticComponent<Omit<SbServerComponentProps, "ref"> & RefAttributes<HTMLElement>>;
185
186
 
186
- export declare const StoryblokServerRichText: ({ document, optimizeImage, components, wrapper, ...rest }: SbRichTextProps_2) => ReactNode;
187
+ export declare const StoryblokServerRichText: ({ document, optimizeImage, components, data, wrapper, ...rest }: SbRichTextProps_2) => ReactNode;
187
188
 
188
189
  /**
189
190
  * Shared server component for rendering Storyblok stories.
package/dist/ssr.d.ts CHANGED
@@ -129,6 +129,7 @@ export declare type SbReactRichTextProps<T extends SbRichTextElement> = SbRichTe
129
129
  export declare interface SbReactRichTextRenderContext {
130
130
  optimizeImage?: boolean | SbRichTextImageOptions;
131
131
  components?: SbReactRichTextComponentMap;
132
+ data?: unknown;
132
133
  }
133
134
 
134
135
  export declare interface SbReactSDKOptions extends SbSDKOptions {
@@ -188,7 +189,7 @@ export declare interface StoryblokRichTextProps extends SbReactRichTextRenderCon
188
189
 
189
190
  export declare const StoryblokServerComponent: ForwardRefExoticComponent<Omit<SbServerComponentProps, "ref"> & RefAttributes<HTMLElement>>;
190
191
 
191
- export declare const StoryblokServerRichText: ({ document, optimizeImage, components, wrapper, ...rest }: SbRichTextProps_2) => ReactNode;
192
+ export declare const StoryblokServerRichText: ({ document, optimizeImage, components, data, wrapper, ...rest }: SbRichTextProps_2) => ReactNode;
192
193
 
193
194
  /**
194
195
  * Shared server component for rendering Storyblok stories.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/react",
3
3
  "type": "module",
4
- "version": "7.1.0",
4
+ "version": "7.2.1",
5
5
  "private": false,
6
6
  "description": "SDK to integrate Storyblok into your project using React.",
7
7
  "author": "Storyblok",
@@ -49,8 +49,8 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@storyblok/richtext": "5.1.0",
53
- "@storyblok/js": "6.1.0"
52
+ "@storyblok/js": "6.2.1",
53
+ "@storyblok/richtext": "5.2.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/core": "^7.27.1",
@@ -61,7 +61,7 @@
61
61
  "@testing-library/react": "^16.3.0",
62
62
  "@tsconfig/recommended": "^1.0.8",
63
63
  "@types/node": "^24.11.0",
64
- "@types/react": "19.1.4",
64
+ "@types/react": "19.2.3",
65
65
  "@vitejs/plugin-react": "^4.4.1",
66
66
  "babel-jest": "^29.7.0",
67
67
  "cypress": "^14.3.3",