@prismicio/react 3.4.1-canary.8e244f3 → 3.4.1-pr.265.f4c6adf

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.
@@ -3,33 +3,33 @@ import {
3
3
  asImagePixelDensitySrcSet,
4
4
  asImageWidthSrcSet,
5
5
  isFilled,
6
- } from "@prismicio/client";
7
- import { DEV } from "esm-env";
8
- import { type ForwardedRef, forwardRef, type ComponentProps, type FC, type ReactNode } from "react";
6
+ } from "@prismicio/client"
7
+ import { DEV } from "esm-env"
8
+ import { type ForwardedRef, forwardRef, type ComponentProps, type FC, type ReactNode } from "react"
9
9
 
10
- import { devMsg } from "./lib/devMsg.js";
10
+ import { devMsg } from "./lib/devMsg.js"
11
11
 
12
12
  type ImgixURLParams = Omit<NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>, "widths"> &
13
- Omit<NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>, "pixelDensities">;
13
+ Omit<NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>, "pixelDensities">
14
14
 
15
15
  /** Props for `<PrismicImage>`. */
16
16
  export type PrismicImageProps = Omit<ComponentProps<"img">, "src" | "srcset" | "alt"> & {
17
17
  /** The Prismic image field or thumbnail to render. */
18
- field: ImageFieldImage | null | undefined;
18
+ field: ImageFieldImage | null | undefined
19
19
 
20
20
  /**
21
21
  * An object of Imgix URL API parameters to transform the image.
22
22
  *
23
23
  * See: https://docs.imgix.com/apis/rendering
24
24
  */
25
- imgixParams?: { [P in keyof ImgixURLParams]: ImgixURLParams[P] | null };
25
+ imgixParams?: { [P in keyof ImgixURLParams]: ImgixURLParams[P] | null }
26
26
 
27
27
  /**
28
28
  * Declare an image as decorative by providing `alt=""`.
29
29
  *
30
30
  * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
31
31
  */
32
- alt?: "";
32
+ alt?: ""
33
33
 
34
34
  /**
35
35
  * Declare an image as decorative only if the image field does not have alternative text by
@@ -37,13 +37,13 @@ export type PrismicImageProps = Omit<ComponentProps<"img">, "src" | "srcset" | "
37
37
  *
38
38
  * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
39
39
  */
40
- fallbackAlt?: "";
40
+ fallbackAlt?: ""
41
41
 
42
42
  /**
43
43
  * The value to be rendered when the field is empty. If a fallback is not given, `null` will be
44
44
  * rendered.
45
45
  */
46
- fallback?: ReactNode;
46
+ fallback?: ReactNode
47
47
  } & (
48
48
  | {
49
49
  /**
@@ -55,13 +55,13 @@ export type PrismicImageProps = Omit<ComponentProps<"img">, "src" | "srcset" | "
55
55
  * If the image field contains responsive views, each responsive view can be used as a width
56
56
  * in the resulting `srcset` by passing `"thumbnails"` as the `widths` prop.
57
57
  */
58
- widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "defaults";
58
+ widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "defaults"
59
59
  /** Not used when the `widths` prop is used. */
60
- pixelDensities?: never;
60
+ pixelDensities?: never
61
61
  }
62
62
  | {
63
63
  /** Not used when the `widths` prop is used. */
64
- widths?: never;
64
+ widths?: never
65
65
  /**
66
66
  * Pixel densities used to build a `srcset` value for the image field.
67
67
  *
@@ -70,15 +70,15 @@ export type PrismicImageProps = Omit<ComponentProps<"img">, "src" | "srcset" | "
70
70
  */
71
71
  pixelDensities:
72
72
  | NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"]
73
- | "defaults";
73
+ | "defaults"
74
74
  }
75
- );
75
+ )
76
76
 
77
77
  /**
78
78
  * Renders an optimized image from a Prismic image field.
79
79
  *
80
80
  * @example
81
- * ```tsx
81
+ * ;```tsx
82
82
  * <PrismicImage field={slice.primary.photo} />;
83
83
  * ```
84
84
  *
@@ -97,7 +97,7 @@ export const PrismicImage: FC<PrismicImageProps> = forwardRef(function PrismicIm
97
97
  pixelDensities,
98
98
  fallback,
99
99
  ...restProps
100
- } = props;
100
+ } = props
101
101
 
102
102
  if (DEV) {
103
103
  if (typeof alt === "string" && alt !== "") {
@@ -105,7 +105,7 @@ export const PrismicImage: FC<PrismicImageProps> = forwardRef(function PrismicIm
105
105
  `[PrismicImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg(
106
106
  "alt-must-be-an-empty-string",
107
107
  )}`,
108
- );
108
+ )
109
109
  }
110
110
 
111
111
  if (typeof fallbackAlt === "string" && fallbackAlt !== "") {
@@ -113,46 +113,46 @@ export const PrismicImage: FC<PrismicImageProps> = forwardRef(function PrismicIm
113
113
  `[PrismicImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg(
114
114
  "alt-must-be-an-empty-string",
115
115
  )}`,
116
- );
116
+ )
117
117
  }
118
118
 
119
119
  if (widths && pixelDensities) {
120
120
  console.warn(
121
121
  `[PrismicImage] Only one of "widths" or "pixelDensities" props can be provided. You can resolve this warning by removing either the "widths" or "pixelDensities" prop. "widths" will be used in this case.`,
122
- );
122
+ )
123
123
  }
124
124
  }
125
125
 
126
126
  if (!isFilled.imageThumbnail(field)) {
127
- return <>{fallback}</>;
127
+ return <>{fallback}</>
128
128
  }
129
129
 
130
- const resolvedImgixParams = imgixParams;
130
+ const resolvedImgixParams = imgixParams
131
131
  for (const x in imgixParams) {
132
132
  if (resolvedImgixParams[x as keyof typeof resolvedImgixParams] === null) {
133
- resolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined;
133
+ resolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined
134
134
  }
135
135
  }
136
136
 
137
- let src: string | undefined;
138
- let srcSet: string | undefined;
137
+ let src: string | undefined
138
+ let srcSet: string | undefined
139
139
 
140
140
  if (widths || !pixelDensities) {
141
141
  const res = asImageWidthSrcSet(field, {
142
142
  ...resolvedImgixParams,
143
143
  widths: widths === "defaults" ? undefined : widths,
144
- } as ImgixURLParams);
144
+ } as ImgixURLParams)
145
145
 
146
- src = res.src;
147
- srcSet = res.srcset;
146
+ src = res.src
147
+ srcSet = res.srcset
148
148
  } else if (pixelDensities) {
149
149
  const res = asImagePixelDensitySrcSet(field, {
150
150
  ...resolvedImgixParams,
151
151
  pixelDensities: pixelDensities === "defaults" ? undefined : pixelDensities,
152
- } as ImgixURLParams);
152
+ } as ImgixURLParams)
153
153
 
154
- src = res.src;
155
- srcSet = res.srcset;
154
+ src = res.src
155
+ srcSet = res.srcset
156
156
  }
157
157
 
158
158
  return (
@@ -163,5 +163,5 @@ export const PrismicImage: FC<PrismicImageProps> = forwardRef(function PrismicIm
163
163
  alt={alt ?? (field.alt || fallbackAlt)}
164
164
  {...restProps}
165
165
  />
166
- );
167
- });
166
+ )
167
+ })
@@ -4,8 +4,8 @@ import {
4
4
  type PrismicDocument,
5
5
  asLinkAttrs,
6
6
  type AsLinkAttrsConfig,
7
- } from "@prismicio/client";
8
- import { DEV } from "esm-env";
7
+ } from "@prismicio/client"
8
+ import { DEV } from "esm-env"
9
9
  import {
10
10
  type ComponentProps,
11
11
  type ComponentType,
@@ -13,32 +13,32 @@ import {
13
13
  type HTMLAttributeAnchorTarget,
14
14
  type ReactNode,
15
15
  forwardRef,
16
- } from "react";
16
+ } from "react"
17
17
 
18
- import { devMsg } from "./lib/devMsg.js";
18
+ import { devMsg } from "./lib/devMsg.js"
19
19
 
20
20
  /** The default component rendered for internal and external links. */
21
- const defaultComponent = "a";
21
+ const defaultComponent = "a"
22
22
 
23
23
  /** Props provided to a component when rendered with `<PrismicLink>`. */
24
24
  export interface LinkProps {
25
25
  /** The URL to link. */
26
- href: string;
26
+ href: string
27
27
 
28
28
  /**
29
29
  * The `target` attribute for anchor elements. If the Prismic field is configured to open in a new
30
30
  * window, this prop defaults to `_blank`.
31
31
  */
32
- target?: HTMLAttributeAnchorTarget;
32
+ target?: HTMLAttributeAnchorTarget
33
33
 
34
34
  /**
35
35
  * The `rel` attribute for anchor elements. If the `target` prop is set to `"_blank"`, this prop
36
36
  * defaults to `"noopener noreferrer"`.
37
37
  */
38
- rel?: string;
38
+ rel?: string
39
39
 
40
40
  /** Children for the component. */
41
- children?: ReactNode;
41
+ children?: ReactNode
42
42
  }
43
43
 
44
44
  export type PrismicLinkProps<
@@ -50,7 +50,7 @@ export type PrismicLinkProps<
50
50
  * external. This prop can be provided a function to use the link's metadata to determine the
51
51
  * `rel` value.
52
52
  */
53
- rel?: string | AsLinkAttrsConfig["rel"];
53
+ rel?: string | AsLinkAttrsConfig["rel"]
54
54
 
55
55
  /**
56
56
  * The link resolver used to resolve links.
@@ -60,7 +60,7 @@ export type PrismicLinkProps<
60
60
  * resolver does not need to be provided.
61
61
  * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}
62
62
  */
63
- linkResolver?: LinkResolverFunction;
63
+ linkResolver?: LinkResolverFunction
64
64
 
65
65
  /**
66
66
  * The component rendered for internal URLs. Defaults to `<a>`.
@@ -68,39 +68,39 @@ export type PrismicLinkProps<
68
68
  * If your app uses a client-side router that requires a special Link component, provide the Link
69
69
  * component to this prop.
70
70
  */
71
- internalComponent?: ComponentType<InternalComponentProps>;
71
+ internalComponent?: ComponentType<InternalComponentProps>
72
72
 
73
73
  /** The component rendered for external URLs. Defaults to `<a>`. */
74
- externalComponent?: ComponentType<ExternalComponentProps>;
74
+ externalComponent?: ComponentType<ExternalComponentProps>
75
75
 
76
76
  /**
77
77
  * The children to render for the link. If no children are provided, the link's `text` property
78
78
  * will be used.
79
79
  */
80
- children?: ReactNode;
80
+ children?: ReactNode
81
81
  } & (
82
82
  | {
83
- document: PrismicDocument | null | undefined;
84
- href?: never;
85
- field?: never;
83
+ document: PrismicDocument | null | undefined
84
+ href?: never
85
+ field?: never
86
86
  }
87
87
  | {
88
- field: LinkField | null | undefined;
89
- href?: never;
90
- document?: never;
88
+ field: LinkField | null | undefined
89
+ href?: never
90
+ document?: never
91
91
  }
92
92
  | {
93
- href: LinkProps["href"];
94
- field?: LinkField | null | undefined;
95
- document?: never;
93
+ href: LinkProps["href"]
94
+ field?: LinkField | null | undefined
95
+ document?: never
96
96
  }
97
- );
97
+ )
98
98
 
99
99
  /**
100
100
  * Renders a link from a Prismic link field or page.
101
101
  *
102
102
  * @example
103
- * ```tsx
103
+ * ;```tsx
104
104
  * <PrismicLink field={slice.primary.link}>Click here</PrismicLink>;
105
105
  * ```
106
106
  *
@@ -121,7 +121,7 @@ export const PrismicLink = forwardRef(function PrismicLink<
121
121
  externalComponent,
122
122
  children,
123
123
  ...restProps
124
- } = props;
124
+ } = props
125
125
 
126
126
  if (DEV) {
127
127
  if (field) {
@@ -129,12 +129,12 @@ export const PrismicLink = forwardRef(function PrismicLink<
129
129
  console.error(
130
130
  `[PrismicLink] This "field" prop value caused an error to be thrown.\n`,
131
131
  field,
132
- );
132
+ )
133
133
  throw new Error(
134
134
  `[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg(
135
135
  "missing-link-properties",
136
136
  )}`,
137
- );
137
+ )
138
138
  } else if (
139
139
  ("text" in field ? Object.keys(field).length > 2 : Object.keys(field).length > 1) &&
140
140
  !("url" in field || "uid" in field || "id" in field)
@@ -144,7 +144,7 @@ export const PrismicLink = forwardRef(function PrismicLink<
144
144
  "missing-link-properties",
145
145
  )}`,
146
146
  field,
147
- );
147
+ )
148
148
  }
149
149
  } else if (doc) {
150
150
  if (!("url" in doc || "id" in doc)) {
@@ -153,7 +153,7 @@ export const PrismicLink = forwardRef(function PrismicLink<
153
153
  "missing-link-properties",
154
154
  )}`,
155
155
  doc,
156
- );
156
+ )
157
157
  }
158
158
  }
159
159
  }
@@ -165,36 +165,36 @@ export const PrismicLink = forwardRef(function PrismicLink<
165
165
  } = asLinkAttrs(field ?? doc, {
166
166
  linkResolver,
167
167
  rel: typeof restProps.rel === "function" ? restProps.rel : undefined,
168
- });
168
+ })
169
169
 
170
- let rel: string | undefined = computedRel;
170
+ let rel: string | undefined = computedRel
171
171
  if ("rel" in restProps && typeof restProps.rel !== "function") {
172
- rel = restProps.rel;
172
+ rel = restProps.rel
173
173
  }
174
174
 
175
- const href = ("href" in restProps ? restProps.href : computedHref) || "";
175
+ const href = ("href" in restProps ? restProps.href : computedHref) || ""
176
176
 
177
- const InternalComponent = (internalComponent || defaultComponent) as ComponentType<LinkProps>;
178
- const ExternalComponent = (externalComponent || defaultComponent) as ComponentType<LinkProps>;
177
+ const InternalComponent = (internalComponent || defaultComponent) as ComponentType<LinkProps>
178
+ const ExternalComponent = (externalComponent || defaultComponent) as ComponentType<LinkProps>
179
179
  const Component = href
180
180
  ? isInternalURL(href)
181
181
  ? InternalComponent
182
182
  : ExternalComponent
183
- : InternalComponent;
183
+ : InternalComponent
184
184
 
185
185
  return (
186
186
  <Component ref={ref} {...attrs} {...restProps} href={href} rel={rel}>
187
187
  {"children" in props ? children : field?.text}
188
188
  </Component>
189
- );
189
+ )
190
190
  }) as <
191
191
  InternalComponentProps = ComponentProps<typeof defaultComponent>,
192
192
  ExternalComponentProps = ComponentProps<typeof defaultComponent>,
193
193
  >(
194
194
  props: PrismicLinkProps<InternalComponentProps, ExternalComponentProps> & {
195
- ref?: ForwardedRef<Element>;
195
+ ref?: ForwardedRef<Element>
196
196
  },
197
- ) => ReactNode;
197
+ ) => ReactNode
198
198
 
199
199
  /**
200
200
  * Determines if a URL is internal or external.
@@ -204,8 +204,8 @@ export const PrismicLink = forwardRef(function PrismicLink<
204
204
  */
205
205
  // TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a "/" or "#"`.
206
206
  export function isInternalURL(url: string): boolean {
207
- const isInternal = /^(\/(?!\/)|#)/.test(url);
208
- const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
207
+ const isInternal = /^(\/(?!\/)|#)/.test(url)
208
+ const isSpecialLink = !isInternal && !/^https?:\/\//.test(url)
209
209
 
210
- return isInternal && !isSpecialLink;
210
+ return isInternal && !isSpecialLink
211
211
  }
@@ -3,15 +3,15 @@ import {
3
3
  type LinkResolverFunction,
4
4
  type RichTextField,
5
5
  type RTAnyNode,
6
- } from "@prismicio/client";
6
+ } from "@prismicio/client"
7
7
  import {
8
8
  composeSerializers,
9
9
  serialize,
10
10
  wrapMapSerializer,
11
11
  type RichTextFunctionSerializer,
12
12
  type RichTextMapSerializer,
13
- } from "@prismicio/client/richtext";
14
- import { DEV } from "esm-env";
13
+ } from "@prismicio/client/richtext"
14
+ import { DEV } from "esm-env"
15
15
  import {
16
16
  cloneElement,
17
17
  type ComponentType,
@@ -19,10 +19,10 @@ import {
19
19
  Fragment,
20
20
  isValidElement,
21
21
  type ReactNode,
22
- } from "react";
22
+ } from "react"
23
23
 
24
- import { devMsg } from "./lib/devMsg.js";
25
- import { type LinkProps, PrismicLink } from "./PrismicLink.js";
24
+ import { devMsg } from "./lib/devMsg.js"
25
+ import { type LinkProps, PrismicLink } from "./PrismicLink.js"
26
26
 
27
27
  /**
28
28
  * A function mapping rich text block types to React Components. It is used to render rich text
@@ -30,22 +30,22 @@ import { type LinkProps, PrismicLink } from "./PrismicLink.js";
30
30
  *
31
31
  * @see Templating rich text fields {@link https://prismic.io/docs/fields/rich-text}
32
32
  */
33
- export type JSXFunctionSerializer = RichTextFunctionSerializer<ReactNode>;
33
+ export type JSXFunctionSerializer = RichTextFunctionSerializer<ReactNode>
34
34
 
35
35
  /**
36
36
  * A map of rich text block types to React Components. It is used to render rich text fields.
37
37
  *
38
38
  * @see Templating rich text fields {@link https://prismic.io/docs/fields/rich-text}
39
39
  */
40
- export type RichTextComponents = RichTextMapSerializer<ReactNode>;
40
+ export type RichTextComponents = RichTextMapSerializer<ReactNode>
41
41
 
42
42
  /** @deprecated Use `RichTextComponents` instead. */
43
- export type JSXMapSerializer = RichTextComponents;
43
+ export type JSXMapSerializer = RichTextComponents
44
44
 
45
45
  /** Props for `<PrismicRichText>`. */
46
46
  export type PrismicRichTextProps = {
47
47
  /** The Prismic rich text field to render. */
48
- field: RichTextField | null | undefined;
48
+ field: RichTextField | null | undefined
49
49
 
50
50
  /**
51
51
  * The link resolver used to resolve links.
@@ -55,7 +55,7 @@ export type PrismicRichTextProps = {
55
55
  * resolver does not need to be provided.
56
56
  * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}
57
57
  */
58
- linkResolver?: LinkResolverFunction;
58
+ linkResolver?: LinkResolverFunction
59
59
 
60
60
  /**
61
61
  * A map or function that maps a rich text block to a React component.
@@ -85,40 +85,40 @@ export type PrismicRichTextProps = {
85
85
  * };
86
86
  * ```
87
87
  */
88
- components?: RichTextComponents | JSXFunctionSerializer;
88
+ components?: RichTextComponents | JSXFunctionSerializer
89
89
 
90
90
  /**
91
91
  * The React component rendered for links when the URL is internal.
92
92
  *
93
93
  * @defaultValue `<a>`
94
94
  */
95
- internalLinkComponent?: ComponentType<LinkProps>;
95
+ internalLinkComponent?: ComponentType<LinkProps>
96
96
 
97
97
  /**
98
98
  * The React component rendered for links when the URL is external.
99
99
  *
100
100
  * @defaultValue `<a>`
101
101
  */
102
- externalLinkComponent?: ComponentType<LinkProps>;
102
+ externalLinkComponent?: ComponentType<LinkProps>
103
103
 
104
104
  /**
105
105
  * The value to be rendered when the field is empty. If a fallback is not given, `null` will be
106
106
  * rendered.
107
107
  */
108
- fallback?: ReactNode;
109
- };
108
+ fallback?: ReactNode
109
+ }
110
110
 
111
111
  type CreateDefaultSerializerArgs = {
112
- linkResolver: LinkResolverFunction | undefined;
113
- internalLinkComponent?: ComponentType<LinkProps>;
114
- externalLinkComponent?: ComponentType<LinkProps>;
115
- };
112
+ linkResolver: LinkResolverFunction | undefined
113
+ internalLinkComponent?: ComponentType<LinkProps>
114
+ externalLinkComponent?: ComponentType<LinkProps>
115
+ }
116
116
 
117
117
  const getDir = (node: RTAnyNode): "rtl" | undefined => {
118
118
  if ("direction" in node && node.direction === "rtl") {
119
- return "rtl";
119
+ return "rtl"
120
120
  }
121
- };
121
+ }
122
122
 
123
123
  const createDefaultSerializer = (args: CreateDefaultSerializerArgs): JSXFunctionSerializer =>
124
124
  wrapMapSerializer<ReactNode>({
@@ -179,7 +179,7 @@ const createDefaultSerializer = (args: CreateDefaultSerializerArgs): JSXFunction
179
179
  alt={node.alt ?? undefined}
180
180
  data-copyright={node.copyright ? node.copyright : undefined}
181
181
  />
182
- );
182
+ )
183
183
 
184
184
  return (
185
185
  <p key={key} className="block-img">
@@ -196,7 +196,7 @@ const createDefaultSerializer = (args: CreateDefaultSerializerArgs): JSXFunction
196
196
  img
197
197
  )}
198
198
  </p>
199
- );
199
+ )
200
200
  },
201
201
  embed: ({ node, key }) => (
202
202
  <div
@@ -224,28 +224,28 @@ const createDefaultSerializer = (args: CreateDefaultSerializerArgs): JSXFunction
224
224
  </span>
225
225
  ),
226
226
  span: ({ text, key }) => {
227
- const result: ReactNode[] = [];
227
+ const result: ReactNode[] = []
228
228
 
229
- let i = 0;
229
+ let i = 0
230
230
  for (const line of text.split("\n")) {
231
231
  if (i > 0) {
232
- result.push(<br key={`${i}__break`} />);
232
+ result.push(<br key={`${i}__break`} />)
233
233
  }
234
234
 
235
- result.push(<Fragment key={`${i}__line`}>{line}</Fragment>);
235
+ result.push(<Fragment key={`${i}__line`}>{line}</Fragment>)
236
236
 
237
- i++;
237
+ i++
238
238
  }
239
239
 
240
- return <Fragment key={key}>{result}</Fragment>;
240
+ return <Fragment key={key}>{result}</Fragment>
241
241
  },
242
- });
242
+ })
243
243
 
244
244
  /**
245
245
  * Renders content from a Prismic rich text field as React components.
246
246
  *
247
247
  * @example
248
- * ```tsx
248
+ * ;```tsx
249
249
  * <PrismicRichText field={slice.primary.text} />;
250
250
  * ```
251
251
  *
@@ -260,7 +260,7 @@ export const PrismicRichText: FC<PrismicRichTextProps> = (props) => {
260
260
  externalLinkComponent,
261
261
  internalLinkComponent,
262
262
  ...restProps
263
- } = props;
263
+ } = props
264
264
 
265
265
  if (DEV) {
266
266
  if ("className" in restProps) {
@@ -269,12 +269,12 @@ export const PrismicRichText: FC<PrismicRichTextProps> = (props) => {
269
269
  "classname-is-not-a-valid-prop",
270
270
  )}.`,
271
271
  field,
272
- );
272
+ )
273
273
  }
274
274
  }
275
275
 
276
276
  if (!isFilled.richText(field)) {
277
- return fallback != null ? <>{fallback}</> : null;
277
+ return fallback != null ? <>{fallback}</> : null
278
278
  }
279
279
 
280
280
  const serializer = composeSerializers<ReactNode>(
@@ -284,24 +284,24 @@ export const PrismicRichText: FC<PrismicRichTextProps> = (props) => {
284
284
  internalLinkComponent,
285
285
  externalLinkComponent,
286
286
  }),
287
- );
287
+ )
288
288
 
289
289
  // The serializer is wrapped in a higher-order function that
290
290
  // automatically applies a key to React Elements if one is not already
291
291
  // given.
292
292
  const serialized = serialize<ReactNode>(field, (type, node, text, children, key) => {
293
- const result = serializer(type, node, text, children, key);
293
+ const result = serializer(type, node, text, children, key)
294
294
 
295
295
  if (isValidElement(result) && result.key == null) {
296
- return cloneElement(result, { key });
296
+ return cloneElement(result, { key })
297
297
  } else {
298
- return result;
298
+ return result
299
299
  }
300
- });
300
+ })
301
301
 
302
302
  if (!serialized) {
303
- return fallback != null ? <>{fallback}</> : null;
303
+ return fallback != null ? <>{fallback}</> : null
304
304
  }
305
305
 
306
- return <>{serialized}</>;
307
- };
306
+ return <>{serialized}</>
307
+ }