@prismicio/next 2.2.0-pr.123.1c009e2 → 2.2.0-pr.125.afe01f5
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/{PrismicImage.d.cts → PrismicNextImage.d.ts} +7 -8
- package/dist/PrismicNextImage.js +69 -0
- package/dist/PrismicNextImage.js.map +1 -0
- package/dist/{PrismicLink.d.cts → PrismicNextLink.d.ts} +6 -7
- package/dist/PrismicNextLink.js +29 -0
- package/dist/PrismicNextLink.js.map +1 -0
- package/dist/{PrismicPreview.d.cts → PrismicPreview.d.ts} +1 -1
- package/dist/PrismicPreview.js +39 -0
- package/dist/PrismicPreview.js.map +1 -0
- package/dist/{PrismicPreviewClient.cjs → PrismicPreviewClient.js} +12 -13
- package/dist/PrismicPreviewClient.js.map +1 -0
- package/dist/{SliceSimulator.d.cts → SliceSimulator.d.ts} +1 -1
- package/dist/SliceSimulator.js +48 -0
- package/dist/SliceSimulator.js.map +1 -0
- package/dist/SliceSimulatorWrapper.js +35 -0
- package/dist/SliceSimulatorWrapper.js.map +1 -0
- package/dist/{createLocaleRedirect.d.cts → createLocaleRedirect.d.ts} +1 -1
- package/dist/createLocaleRedirect.js +14 -0
- package/dist/createLocaleRedirect.js.map +1 -0
- package/dist/{enableAutoPreviews.d.cts → enableAutoPreviews.d.ts} +1 -1
- package/dist/{enableAutoPreviews.cjs → enableAutoPreviews.js} +7 -8
- package/dist/enableAutoPreviews.js.map +1 -0
- package/dist/{exitPreview.d.cts → exitPreview.d.ts} +1 -1
- package/dist/{exitPreview.cjs → exitPreview.js} +2 -3
- package/dist/exitPreview.js.map +1 -0
- package/dist/{getSlices.d.cts → getSlices.d.ts} +1 -1
- package/dist/getSlices.js +11 -0
- package/dist/getSlices.js.map +1 -0
- package/dist/{imgixLoader.d.cts → imgixLoader.d.ts} +1 -1
- package/dist/{imgixLoader.cjs → imgixLoader.js} +4 -5
- package/dist/imgixLoader.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/lib/{devMsg.cjs → devMsg.js} +4 -4
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/{resolveDefaultExport.cjs → resolveDefaultExport.js} +2 -3
- package/dist/lib/resolveDefaultExport.js.map +1 -0
- package/dist/package.js +6 -0
- package/dist/package.js.map +1 -0
- package/dist/pages/{PrismicPreview.d.cts → PrismicPreview.d.ts} +1 -1
- package/dist/pages/{PrismicPreview.cjs → PrismicPreview.js} +13 -15
- package/dist/pages/PrismicPreview.js.map +1 -0
- package/dist/pages/{SliceSimulator.d.cts → SliceSimulator.d.ts} +1 -1
- package/dist/pages/SliceSimulator.js +40 -0
- package/dist/pages/SliceSimulator.js.map +1 -0
- package/dist/pages/{enableAutoPreviews.d.cts → enableAutoPreviews.d.ts} +2 -2
- package/dist/pages/{enableAutoPreviews.cjs → enableAutoPreviews.js} +2 -3
- package/dist/pages/enableAutoPreviews.js.map +1 -0
- package/dist/pages/{exitPreview.d.cts → exitPreview.d.ts} +2 -2
- package/dist/pages/{exitPreview.cjs → exitPreview.js} +2 -3
- package/dist/pages/exitPreview.js.map +1 -0
- package/dist/pages/{redirectToPreviewURL.d.cts → redirectToPreviewURL.d.ts} +2 -2
- package/dist/pages/{redirectToPreviewURL.cjs → redirectToPreviewURL.js} +2 -3
- package/dist/pages/redirectToPreviewURL.js.map +1 -0
- package/dist/pages/{setPreviewData.d.cts → setPreviewData.d.ts} +2 -2
- package/dist/pages/setPreviewData.js +12 -0
- package/dist/pages/setPreviewData.js.map +1 -0
- package/dist/pages/{types.d.cts → types.d.ts} +2 -2
- package/dist/pages.d.ts +12 -0
- package/dist/pages.js +12 -0
- package/dist/{redirectToPreviewURL.d.cts → redirectToPreviewURL.d.ts} +2 -2
- package/dist/{redirectToPreviewURL.cjs → redirectToPreviewURL.js} +6 -7
- package/dist/redirectToPreviewURL.js.map +1 -0
- package/dist/{types.d.cts → types.d.ts} +1 -1
- package/package.json +5 -18
- package/src/PrismicNextImage.tsx +185 -0
- package/src/PrismicNextLink.tsx +67 -0
- package/src/index.ts +5 -21
- package/src/pages/index.ts +4 -20
- package/dist/PrismicImage.cjs +0 -71
- package/dist/PrismicImage.cjs.map +0 -1
- package/dist/PrismicLink.cjs +0 -31
- package/dist/PrismicLink.cjs.map +0 -1
- package/dist/PrismicPreview.cjs +0 -41
- package/dist/PrismicPreview.cjs.map +0 -1
- package/dist/PrismicPreviewClient.cjs.map +0 -1
- package/dist/PrismicRichText.cjs +0 -50
- package/dist/PrismicRichText.cjs.map +0 -1
- package/dist/PrismicRichText.d.cts +0 -27
- package/dist/PrismicTable.cjs +0 -34
- package/dist/PrismicTable.cjs.map +0 -1
- package/dist/PrismicTable.d.cts +0 -22
- package/dist/SliceSimulator.cjs +0 -49
- package/dist/SliceSimulator.cjs.map +0 -1
- package/dist/SliceSimulatorWrapper.cjs +0 -36
- package/dist/SliceSimulatorWrapper.cjs.map +0 -1
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/createLocaleRedirect.cjs +0 -14
- package/dist/createLocaleRedirect.cjs.map +0 -1
- package/dist/enableAutoPreviews.cjs.map +0 -1
- package/dist/exitPreview.cjs.map +0 -1
- package/dist/getSlices.cjs +0 -12
- package/dist/getSlices.cjs.map +0 -1
- package/dist/imgixLoader.cjs.map +0 -1
- package/dist/index.cjs +0 -47
- package/dist/index.d.cts +0 -15
- package/dist/lib/devMsg.cjs.map +0 -1
- package/dist/lib/resolveDefaultExport.cjs.map +0 -1
- package/dist/package.cjs +0 -12
- package/dist/package.cjs.map +0 -1
- package/dist/pages/PrismicPreview.cjs.map +0 -1
- package/dist/pages/SliceSimulator.cjs +0 -41
- package/dist/pages/SliceSimulator.cjs.map +0 -1
- package/dist/pages/enableAutoPreviews.cjs.map +0 -1
- package/dist/pages/exitPreview.cjs.map +0 -1
- package/dist/pages/redirectToPreviewURL.cjs.map +0 -1
- package/dist/pages/setPreviewData.cjs +0 -13
- package/dist/pages/setPreviewData.cjs.map +0 -1
- package/dist/pages.cjs +0 -47
- package/dist/pages.d.cts +0 -15
- package/dist/redirectToPreviewURL.cjs.map +0 -1
- package/src/PrismicImage.tsx +0 -187
- package/src/PrismicLink.tsx +0 -74
- package/src/PrismicRichText.tsx +0 -63
- package/src/PrismicTable.tsx +0 -33
package/src/PrismicImage.tsx
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { imgixLoader } from "./imgixLoader";
|
|
4
|
-
import { devMsg } from "./lib/devMsg";
|
|
5
|
-
import { resolveDefaultExport } from "./lib/resolveDefaultExport";
|
|
6
|
-
import type { ImageFieldImage } from "@prismicio/client";
|
|
7
|
-
import { isFilled } from "@prismicio/client";
|
|
8
|
-
import type { ImgixURLParams } from "imgix-url-builder";
|
|
9
|
-
import { buildURL } from "imgix-url-builder";
|
|
10
|
-
import type { ImageProps } from "next/image";
|
|
11
|
-
import Image from "next/image";
|
|
12
|
-
import type {
|
|
13
|
-
ForwardRefExoticComponent,
|
|
14
|
-
PropsWithoutRef,
|
|
15
|
-
RefAttributes,
|
|
16
|
-
} from "react";
|
|
17
|
-
import { forwardRef } from "react";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `PrismicImage` instead.
|
|
21
|
-
*/
|
|
22
|
-
export { PrismicImage as PrismicNextImage };
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Use `PrismicImageProps` instead.
|
|
26
|
-
*/
|
|
27
|
-
export type { PrismicImageProps as PrismicNextImageProps };
|
|
28
|
-
|
|
29
|
-
const castInt = (input: string | number | undefined): number | undefined => {
|
|
30
|
-
if (typeof input === "number" || typeof input === "undefined") {
|
|
31
|
-
return input;
|
|
32
|
-
} else {
|
|
33
|
-
const parsed = Number.parseInt(input);
|
|
34
|
-
|
|
35
|
-
if (Number.isNaN(parsed)) {
|
|
36
|
-
return undefined;
|
|
37
|
-
} else {
|
|
38
|
-
return parsed;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type PrismicImageProps = Omit<ImageProps, "src" | "alt" | "loader"> & {
|
|
44
|
-
/** The Prismic Image field or thumbnail to render. */
|
|
45
|
-
field: ImageFieldImage | null | undefined;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* An object of Imgix URL API parameters to transform the image.
|
|
49
|
-
*
|
|
50
|
-
* @see https://docs.imgix.com/apis/rendering
|
|
51
|
-
*/
|
|
52
|
-
imgixParams?: { [P in keyof ImgixURLParams]: ImgixURLParams[P] | null };
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Declare an image as decorative by providing `alt=""`.
|
|
56
|
-
*
|
|
57
|
-
* See:
|
|
58
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
|
|
59
|
-
*/
|
|
60
|
-
alt?: "";
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Declare an image as decorative only if the Image field does not have
|
|
64
|
-
* alternative text by providing `fallbackAlt=""`.
|
|
65
|
-
*
|
|
66
|
-
* See:
|
|
67
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
|
|
68
|
-
*/
|
|
69
|
-
fallbackAlt?: "";
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Rendered when the field is empty. If a fallback is not given, `null` will
|
|
73
|
-
* be rendered.
|
|
74
|
-
*/
|
|
75
|
-
fallback?: React.ReactNode;
|
|
76
|
-
|
|
77
|
-
loader?: ImageProps["loader"] | null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* React component that renders an image from a Prismic Image field or one of
|
|
82
|
-
* its thumbnails using `next/image`. It will automatically set the `alt`
|
|
83
|
-
* attribute using the Image field's `alt` property.
|
|
84
|
-
*
|
|
85
|
-
* It uses an Imgix URL-based loader by default. A custom loader can be provided
|
|
86
|
-
* with the `loader` prop. If you would like to use the Next.js Image
|
|
87
|
-
* Optimization API instead, set `loader={undefined}`.
|
|
88
|
-
*
|
|
89
|
-
* @param props - Props for the component.
|
|
90
|
-
*
|
|
91
|
-
* @returns A responsive image component using `next/image` for the given Image
|
|
92
|
-
* field.
|
|
93
|
-
*
|
|
94
|
-
* @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image
|
|
95
|
-
*/
|
|
96
|
-
// The type annotation is necessary to avoid a type reference issue.
|
|
97
|
-
export const PrismicImage: ForwardRefExoticComponent<
|
|
98
|
-
PropsWithoutRef<PrismicImageProps> & RefAttributes<HTMLImageElement>
|
|
99
|
-
> = forwardRef<HTMLImageElement, PrismicImageProps>(function PrismicImage(
|
|
100
|
-
{
|
|
101
|
-
field,
|
|
102
|
-
imgixParams = {},
|
|
103
|
-
alt,
|
|
104
|
-
fallbackAlt,
|
|
105
|
-
fill,
|
|
106
|
-
width,
|
|
107
|
-
height,
|
|
108
|
-
fallback = null,
|
|
109
|
-
loader = imgixLoader,
|
|
110
|
-
...restProps
|
|
111
|
-
},
|
|
112
|
-
ref,
|
|
113
|
-
) {
|
|
114
|
-
if (process.env.NODE_ENV === "development") {
|
|
115
|
-
if (typeof alt === "string" && alt !== "") {
|
|
116
|
-
console.warn(
|
|
117
|
-
`[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(
|
|
118
|
-
"alt-must-be-an-empty-string",
|
|
119
|
-
)}`,
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (typeof fallbackAlt === "string" && fallbackAlt !== "") {
|
|
124
|
-
console.warn(
|
|
125
|
-
`[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(
|
|
126
|
-
"alt-must-be-an-empty-string",
|
|
127
|
-
)}`,
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (!isFilled.imageThumbnail(field)) {
|
|
133
|
-
return <>{fallback}</>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const resolvedImgixParams = imgixParams;
|
|
137
|
-
for (const x in imgixParams) {
|
|
138
|
-
if (resolvedImgixParams[x as keyof typeof resolvedImgixParams] === null) {
|
|
139
|
-
resolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const src = buildURL(field.url, imgixParams as ImgixURLParams);
|
|
144
|
-
|
|
145
|
-
const ar = field.dimensions.width / field.dimensions.height;
|
|
146
|
-
|
|
147
|
-
const castedWidth = castInt(width);
|
|
148
|
-
const castedHeight = castInt(height);
|
|
149
|
-
|
|
150
|
-
let resolvedWidth = castedWidth ?? field.dimensions.width;
|
|
151
|
-
let resolvedHeight = castedHeight ?? field.dimensions.height;
|
|
152
|
-
|
|
153
|
-
if (castedWidth != null && castedHeight == null) {
|
|
154
|
-
resolvedHeight = castedWidth / ar;
|
|
155
|
-
} else if (castedWidth == null && castedHeight != null) {
|
|
156
|
-
resolvedWidth = castedHeight * ar;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// A non-null assertion is required since we can't statically
|
|
160
|
-
// know if an alt attribute is available.
|
|
161
|
-
const resolvedAlt = (alt ?? (field.alt || fallbackAlt))!;
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
process.env.NODE_ENV === "development" &&
|
|
165
|
-
typeof resolvedAlt !== "string"
|
|
166
|
-
) {
|
|
167
|
-
console.error(
|
|
168
|
-
`[PrismicImage] The following image is missing an "alt" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \`alt=""\` or \`fallbackAlt=""\`.`,
|
|
169
|
-
src,
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const ResolvedImage = resolveDefaultExport(Image);
|
|
174
|
-
|
|
175
|
-
return (
|
|
176
|
-
<ResolvedImage
|
|
177
|
-
ref={ref}
|
|
178
|
-
src={src}
|
|
179
|
-
width={fill ? undefined : resolvedWidth}
|
|
180
|
-
height={fill ? undefined : resolvedHeight}
|
|
181
|
-
alt={resolvedAlt}
|
|
182
|
-
fill={fill}
|
|
183
|
-
loader={loader === null ? undefined : loader}
|
|
184
|
-
{...restProps}
|
|
185
|
-
/>
|
|
186
|
-
);
|
|
187
|
-
});
|
package/src/PrismicLink.tsx
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { resolveDefaultExport } from "./lib/resolveDefaultExport";
|
|
2
|
-
import type {
|
|
3
|
-
AsLinkAttrsConfig,
|
|
4
|
-
LinkField,
|
|
5
|
-
LinkResolverFunction,
|
|
6
|
-
PrismicDocument,
|
|
7
|
-
} from "@prismicio/client";
|
|
8
|
-
import { asLinkAttrs } from "@prismicio/client";
|
|
9
|
-
import Link from "next/link";
|
|
10
|
-
import type { ComponentProps } from "react";
|
|
11
|
-
import { forwardRef } from "react";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use `PrismicLink` instead.
|
|
15
|
-
*/
|
|
16
|
-
export { PrismicLink as PrismicNextLink } from "./PrismicLink";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use `PrismicLinkProps` instead.
|
|
20
|
-
*/
|
|
21
|
-
export type { PrismicLinkProps as PrismicNextLinkProps } from "./PrismicLink";
|
|
22
|
-
|
|
23
|
-
export type PrismicLinkProps = Omit<
|
|
24
|
-
ComponentProps<typeof Link>,
|
|
25
|
-
"field" | "document" | "href" | "rel"
|
|
26
|
-
> & {
|
|
27
|
-
linkResolver?: LinkResolverFunction;
|
|
28
|
-
rel?: string | AsLinkAttrsConfig["rel"];
|
|
29
|
-
} & (
|
|
30
|
-
| {
|
|
31
|
-
field: LinkField | null | undefined;
|
|
32
|
-
document?: never;
|
|
33
|
-
href?: never;
|
|
34
|
-
}
|
|
35
|
-
| {
|
|
36
|
-
field?: never;
|
|
37
|
-
document: PrismicDocument | null | undefined;
|
|
38
|
-
href?: never;
|
|
39
|
-
}
|
|
40
|
-
| {
|
|
41
|
-
field?: never;
|
|
42
|
-
document?: never;
|
|
43
|
-
href: ComponentProps<typeof Link>["href"];
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export const PrismicLink = forwardRef<HTMLAnchorElement, PrismicLinkProps>(
|
|
48
|
-
function PrismicLink(props, ref) {
|
|
49
|
-
const { field, document, linkResolver, children, ...restProps } = props;
|
|
50
|
-
const {
|
|
51
|
-
href: computedHref,
|
|
52
|
-
rel: computedRel,
|
|
53
|
-
...attrs
|
|
54
|
-
} = asLinkAttrs(field ?? document, {
|
|
55
|
-
linkResolver,
|
|
56
|
-
rel: typeof restProps.rel === "function" ? restProps.rel : undefined,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const href = ("href" in restProps ? restProps.href : computedHref) || "";
|
|
60
|
-
|
|
61
|
-
let rel = computedRel;
|
|
62
|
-
if ("rel" in restProps && typeof restProps.rel !== "function") {
|
|
63
|
-
rel = restProps.rel;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const ResolvedLink = resolveDefaultExport(Link);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<ResolvedLink ref={ref} {...attrs} {...restProps} href={href} rel={rel}>
|
|
70
|
-
{"children" in props ? children : field?.text}
|
|
71
|
-
</ResolvedLink>
|
|
72
|
-
);
|
|
73
|
-
},
|
|
74
|
-
);
|
package/src/PrismicRichText.tsx
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { PrismicImage } from "./PrismicImage";
|
|
4
|
-
import { PrismicLink } from "./PrismicLink";
|
|
5
|
-
import {
|
|
6
|
-
PrismicRichText as BasePrismicRichText,
|
|
7
|
-
type PrismicRichTextProps as BasePrismicRichTextProps,
|
|
8
|
-
type RichTextComponents,
|
|
9
|
-
} from "@prismicio/react";
|
|
10
|
-
import type { FC } from "react";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Props for `<PrismicRichText>`.
|
|
14
|
-
*/
|
|
15
|
-
export type PrismicRichTextProps = Omit<
|
|
16
|
-
BasePrismicRichTextProps,
|
|
17
|
-
"components"
|
|
18
|
-
> & {
|
|
19
|
-
components?: RichTextComponents;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const defaultComponents: RichTextComponents = {
|
|
23
|
-
image: ({ node, key }) => {
|
|
24
|
-
return (
|
|
25
|
-
<p key={key} className="block-img">
|
|
26
|
-
{node.linkTo ? (
|
|
27
|
-
<PrismicLink field={node.linkTo}>
|
|
28
|
-
<PrismicImage field={node} />
|
|
29
|
-
</PrismicLink>
|
|
30
|
-
) : (
|
|
31
|
-
<PrismicImage field={node} />
|
|
32
|
-
)}
|
|
33
|
-
</p>
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
hyperlink: ({ node, children }) => (
|
|
37
|
-
<PrismicLink field={node.data}>{children}</PrismicLink>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Renders content from a Prismic rich text field as React components with
|
|
43
|
-
* Next.js-optimized defaults for images and links.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
*
|
|
47
|
-
* ```tsx
|
|
48
|
-
* <PrismicRichText field={slice.primary.text} />;
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @see {@link https://prismic.io/docs/fields/rich-text}
|
|
52
|
-
*/
|
|
53
|
-
export const PrismicRichText: FC<PrismicRichTextProps> = ({
|
|
54
|
-
components,
|
|
55
|
-
...restProps
|
|
56
|
-
}) => {
|
|
57
|
-
return (
|
|
58
|
-
<BasePrismicRichText
|
|
59
|
-
components={{ ...defaultComponents, ...components }}
|
|
60
|
-
{...restProps}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
};
|
package/src/PrismicTable.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { defaultComponents } from "./PrismicRichText";
|
|
4
|
-
import {
|
|
5
|
-
PrismicTable as BasePrismicTable,
|
|
6
|
-
type PrismicTableProps,
|
|
7
|
-
} from "@prismicio/react";
|
|
8
|
-
import type { FC } from "react";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Renders content from a Prismic table field as React components with
|
|
12
|
-
* Next.js-optimized defaults for images and links in cell content.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <PrismicTable field={slice.primary.pricing_table} />;
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @see Learn how to style tables and customize table element components:
|
|
21
|
-
* {@link https://prismic.io/docs/fields/table}
|
|
22
|
-
*/
|
|
23
|
-
export const PrismicTable: FC<PrismicTableProps> = ({
|
|
24
|
-
components,
|
|
25
|
-
...restProps
|
|
26
|
-
}) => {
|
|
27
|
-
return (
|
|
28
|
-
<BasePrismicTable
|
|
29
|
-
components={{ ...defaultComponents, ...components }}
|
|
30
|
-
{...restProps}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
};
|