@foundrykit/blocks 2.1.1 → 3.0.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/dist/index.d.ts +245 -1
- package/dist/index.js +1084 -46
- package/dist/index.js.map +1 -1
- package/package.json +18 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,250 @@
|
|
|
1
1
|
export { WorldMap } from '@foundrykit/maps';
|
|
2
2
|
export { cn } from '@foundrykit/utils';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { RichText } from '@payloadcms/richtext-lexical/react';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Block, Field, CollectionSlug } from 'payload';
|
|
7
|
+
|
|
8
|
+
/** Fields every block has (see `sectionFields`). */
|
|
9
|
+
type BlockBase = {
|
|
10
|
+
id?: string | null;
|
|
11
|
+
blockName?: string | null;
|
|
12
|
+
blockType?: string;
|
|
13
|
+
sectionTheme?: string | null;
|
|
14
|
+
anchorId?: string | null;
|
|
15
|
+
};
|
|
16
|
+
type RichTextValue = React.ComponentProps<typeof RichText>['data'];
|
|
17
|
+
/** An upload: the populated doc, or just its id at depth 0. */
|
|
18
|
+
type MediaValue = {
|
|
19
|
+
url?: string | null;
|
|
20
|
+
alt?: string | null;
|
|
21
|
+
width?: number | null;
|
|
22
|
+
height?: number | null;
|
|
23
|
+
} | number | string | null | undefined;
|
|
24
|
+
type LinkValue = {
|
|
25
|
+
type?: 'reference' | 'custom' | null;
|
|
26
|
+
newTab?: boolean | null;
|
|
27
|
+
reference?: {
|
|
28
|
+
relationTo: string;
|
|
29
|
+
value: number | string | {
|
|
30
|
+
slug?: string | null;
|
|
31
|
+
};
|
|
32
|
+
} | null;
|
|
33
|
+
url?: string | null;
|
|
34
|
+
label?: string | null;
|
|
35
|
+
appearance?: 'default' | 'outline' | 'link' | null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type AnchorBarBlockProps = BlockBase & {
|
|
39
|
+
links?: {
|
|
40
|
+
id?: string | null;
|
|
41
|
+
label?: string | null;
|
|
42
|
+
anchor?: string | null;
|
|
43
|
+
}[] | null;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A sticky row of in-page links, in a "On this page" nav landmark. It
|
|
47
|
+
* scrolls sideways on small screens rather than wrapping.
|
|
48
|
+
*/
|
|
49
|
+
declare function AnchorBarBlock(props: AnchorBarBlockProps): react_jsx_runtime.JSX.Element | null;
|
|
50
|
+
|
|
51
|
+
type BannerBlockProps = BlockBase & {
|
|
52
|
+
style?: 'info' | 'success' | 'warning' | 'error' | null;
|
|
53
|
+
content?: RichTextValue | null;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A highlighted notice. The colour carries no meaning on its own: screen
|
|
57
|
+
* readers hear its label ("Warning: …") first.
|
|
58
|
+
*/
|
|
59
|
+
declare function BannerBlock(props: BannerBlockProps): react_jsx_runtime.JSX.Element;
|
|
60
|
+
|
|
61
|
+
type CallToActionBlockProps = BlockBase & {
|
|
62
|
+
heading?: string | null;
|
|
63
|
+
body?: string | null;
|
|
64
|
+
links?: {
|
|
65
|
+
id?: string | null;
|
|
66
|
+
link?: LinkValue | null;
|
|
67
|
+
}[] | null;
|
|
68
|
+
};
|
|
69
|
+
/** A centred heading, a sentence and up to two buttons. */
|
|
70
|
+
declare function CallToActionBlock(props: CallToActionBlockProps): react_jsx_runtime.JSX.Element;
|
|
71
|
+
|
|
72
|
+
type CardGridBlockProps = BlockBase & {
|
|
73
|
+
heading?: string | null;
|
|
74
|
+
intro?: string | null;
|
|
75
|
+
cards?: {
|
|
76
|
+
id?: string | null;
|
|
77
|
+
image?: MediaValue;
|
|
78
|
+
title?: string | null;
|
|
79
|
+
description?: string | null;
|
|
80
|
+
enableLink?: boolean | null;
|
|
81
|
+
link?: LinkValue | null;
|
|
82
|
+
}[] | null;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Cards in a responsive grid. A linked card is one link (its title) stretched
|
|
86
|
+
* over the whole card, so it's one tab stop with a sensible name.
|
|
87
|
+
*/
|
|
88
|
+
declare function CardGridBlock(props: CardGridBlockProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
|
|
90
|
+
type ContentBlockProps = BlockBase & {
|
|
91
|
+
columns?: {
|
|
92
|
+
id?: string | null;
|
|
93
|
+
size?: 'full' | 'twoThirds' | 'half' | 'oneThird' | null;
|
|
94
|
+
richText?: RichTextValue | null;
|
|
95
|
+
}[] | null;
|
|
96
|
+
};
|
|
97
|
+
/** Rich text in up to three columns that stack on small screens. */
|
|
98
|
+
declare function ContentBlock(props: ContentBlockProps): react_jsx_runtime.JSX.Element;
|
|
99
|
+
|
|
100
|
+
type FAQBlockProps = BlockBase & {
|
|
101
|
+
heading?: string | null;
|
|
102
|
+
intro?: string | null;
|
|
103
|
+
items?: {
|
|
104
|
+
id?: string | null;
|
|
105
|
+
question?: string | null;
|
|
106
|
+
answer?: RichTextValue | null;
|
|
107
|
+
}[] | null;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Questions as native `<details>`: keyboard and screen-reader support for
|
|
111
|
+
* free, and the answers are in the HTML for search engines. The height
|
|
112
|
+
* animates through `interpolate-size` (set on :root by @foundrykit/tailwind).
|
|
113
|
+
*/
|
|
114
|
+
declare function FAQBlock(props: FAQBlockProps): react_jsx_runtime.JSX.Element;
|
|
115
|
+
|
|
116
|
+
type GalleryBlockProps = BlockBase & {
|
|
117
|
+
heading?: string | null;
|
|
118
|
+
columns?: '2' | '3' | '4' | null;
|
|
119
|
+
images?: {
|
|
120
|
+
id?: string | null;
|
|
121
|
+
image?: MediaValue;
|
|
122
|
+
caption?: string | null;
|
|
123
|
+
}[] | null;
|
|
124
|
+
};
|
|
125
|
+
/** A grid of images, each a `<figure>` with its upload's alt text and an optional caption. */
|
|
126
|
+
declare function GalleryBlock(props: GalleryBlockProps): react_jsx_runtime.JSX.Element;
|
|
127
|
+
|
|
128
|
+
declare const AnchorBar: Block;
|
|
129
|
+
|
|
130
|
+
declare const Banner: Block;
|
|
131
|
+
|
|
132
|
+
declare const CallToAction: Block;
|
|
133
|
+
|
|
134
|
+
declare const CardGrid: Block;
|
|
135
|
+
|
|
136
|
+
declare const Content: Block;
|
|
137
|
+
|
|
138
|
+
declare const FAQ: Block;
|
|
139
|
+
|
|
140
|
+
declare const Gallery: Block;
|
|
141
|
+
|
|
142
|
+
declare const MediaBlock$1: Block;
|
|
143
|
+
|
|
144
|
+
declare const Tabs: Block;
|
|
145
|
+
|
|
146
|
+
declare const Testimonials$1: Block;
|
|
147
|
+
|
|
148
|
+
declare const index_configs_AnchorBar: typeof AnchorBar;
|
|
149
|
+
declare const index_configs_Banner: typeof Banner;
|
|
150
|
+
declare const index_configs_CallToAction: typeof CallToAction;
|
|
151
|
+
declare const index_configs_CardGrid: typeof CardGrid;
|
|
152
|
+
declare const index_configs_Content: typeof Content;
|
|
153
|
+
declare const index_configs_FAQ: typeof FAQ;
|
|
154
|
+
declare const index_configs_Gallery: typeof Gallery;
|
|
155
|
+
declare const index_configs_Tabs: typeof Tabs;
|
|
156
|
+
declare namespace index_configs {
|
|
157
|
+
export { index_configs_AnchorBar as AnchorBar, index_configs_Banner as Banner, index_configs_CallToAction as CallToAction, index_configs_CardGrid as CardGrid, index_configs_Content as Content, index_configs_FAQ as FAQ, index_configs_Gallery as Gallery, MediaBlock$1 as MediaBlock, index_configs_Tabs as Tabs, Testimonials$1 as Testimonials };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
type MediaBlockProps = BlockBase & {
|
|
161
|
+
media?: MediaValue;
|
|
162
|
+
caption?: string | null;
|
|
163
|
+
width?: 'container' | 'narrow' | null;
|
|
164
|
+
};
|
|
165
|
+
/** One image with an optional caption; the alt text comes from the upload. */
|
|
166
|
+
declare function MediaBlock(props: MediaBlockProps): react_jsx_runtime.JSX.Element;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Whether a custom link URL is safe to put in an href: http(s), mailto, tel,
|
|
170
|
+
* a same-site path or an #anchor. Anything else (`javascript:`, `data:`,
|
|
171
|
+
* `//host`) is rejected, so an editor can't store script in a link.
|
|
172
|
+
*/
|
|
173
|
+
declare const isSafeUrl: (url: string) => boolean;
|
|
174
|
+
/** The themes @foundrykit/tailwind ships; pass your own to {@link sectionTheme}. */
|
|
175
|
+
declare const SECTION_THEMES: {
|
|
176
|
+
label: string;
|
|
177
|
+
value: string;
|
|
178
|
+
}[];
|
|
179
|
+
/**
|
|
180
|
+
* The block's colour theme, rendered as `<Section theme>`. Add a theme by
|
|
181
|
+
* passing it here and defining `[data-section-theme="<value>"]` in your CSS.
|
|
182
|
+
*/
|
|
183
|
+
declare const sectionTheme: ({ themes, defaultValue, }?: {
|
|
184
|
+
themes?: {
|
|
185
|
+
label: string;
|
|
186
|
+
value: string;
|
|
187
|
+
}[];
|
|
188
|
+
defaultValue?: string;
|
|
189
|
+
}) => Field;
|
|
190
|
+
/** An id an Anchor Bar (or any `#link`) can jump to. */
|
|
191
|
+
declare const anchorId: () => Field;
|
|
192
|
+
/** Theme and anchor side by side: every block starts with this row. */
|
|
193
|
+
declare const sectionFields: (options?: Parameters<typeof sectionTheme>[0]) => Field;
|
|
194
|
+
type LinkOptions = {
|
|
195
|
+
/** Collections an internal link can point at. */
|
|
196
|
+
relationTo?: CollectionSlug[];
|
|
197
|
+
/** Button styles to pick from; `false` hides the choice. */
|
|
198
|
+
appearances?: ('default' | 'outline' | 'link')[] | false;
|
|
199
|
+
/** Hide this link unless the condition holds (e.g. an "add a link" checkbox). */
|
|
200
|
+
condition?: (data: unknown, siblingData: Record<string, unknown>) => boolean;
|
|
201
|
+
};
|
|
202
|
+
/** An internal page or a custom URL, with a label: like the Payload website template's `link`. */
|
|
203
|
+
declare const link: ({ relationTo, appearances, condition, }?: LinkOptions) => Field;
|
|
204
|
+
/** Up to `maxRows` links (buttons), like the website template's `linkGroup`. */
|
|
205
|
+
declare const linkGroup: ({ maxRows, ...options }?: LinkOptions & {
|
|
206
|
+
maxRows?: number;
|
|
207
|
+
}) => Field;
|
|
208
|
+
/**
|
|
209
|
+
* An admin block-picker thumbnail as a data URI, so a block needs no image
|
|
210
|
+
* file: `body` is SVG drawn on a 480×320 canvas.
|
|
211
|
+
*/
|
|
212
|
+
declare const thumbnail: (body: string) => string;
|
|
213
|
+
|
|
214
|
+
declare function richText(...blocks: (string | ['h2' | 'h3', string])[]): RichTextValue;
|
|
215
|
+
/** A seed link to a custom URL (internal links need a page id, which seeds don't have). */
|
|
216
|
+
declare const seedLink: (label: string, url: string, appearance?: "default" | "outline" | "link") => {
|
|
217
|
+
type: "custom";
|
|
218
|
+
url: string;
|
|
219
|
+
label: string;
|
|
220
|
+
appearance: "default" | "outline" | "link";
|
|
221
|
+
newTab: boolean;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
type TabsBlockProps = BlockBase & {
|
|
225
|
+
heading?: string | null;
|
|
226
|
+
tabs?: {
|
|
227
|
+
id?: string | null;
|
|
228
|
+
label?: string | null;
|
|
229
|
+
content?: RichTextValue | null;
|
|
230
|
+
}[] | null;
|
|
231
|
+
};
|
|
232
|
+
/** Content in tabs. The panels render on the server; only the tab switching ships JS. */
|
|
233
|
+
declare function TabsBlock(props: TabsBlockProps): react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
235
|
+
type TestimonialsBlockProps = BlockBase & {
|
|
236
|
+
heading?: string | null;
|
|
237
|
+
items?: {
|
|
238
|
+
id?: string | null;
|
|
239
|
+
quote?: string | null;
|
|
240
|
+
name?: string | null;
|
|
241
|
+
role?: string | null;
|
|
242
|
+
avatar?: MediaValue;
|
|
243
|
+
rating?: number | null;
|
|
244
|
+
}[] | null;
|
|
245
|
+
};
|
|
246
|
+
/** Customer quotes as `<figure>`s: the quote in a `<blockquote>`, the person in its caption. */
|
|
247
|
+
declare function TestimonialsBlock(props: TestimonialsBlockProps): react_jsx_runtime.JSX.Element;
|
|
4
248
|
|
|
5
249
|
interface HeroMinimalProps {
|
|
6
250
|
title?: string;
|
|
@@ -68,4 +312,4 @@ interface TestimonialsProps {
|
|
|
68
312
|
*/
|
|
69
313
|
declare function Testimonials({ testimonials, title, subtitle, className, }: TestimonialsProps): react_jsx_runtime.JSX.Element;
|
|
70
314
|
|
|
71
|
-
export { HeroMinimal, Pricing, Testimonials };
|
|
315
|
+
export { AnchorBarBlock, type AnchorBarBlockProps, BannerBlock, type BannerBlockProps, type BlockBase, CallToActionBlock, type CallToActionBlockProps, CardGridBlock, type CardGridBlockProps, ContentBlock, type ContentBlockProps, FAQBlock, type FAQBlockProps, GalleryBlock, type GalleryBlockProps, HeroMinimal, type LinkOptions, type LinkValue, MediaBlock, type MediaBlockProps, type MediaValue, Pricing, type RichTextValue, SECTION_THEMES, TabsBlock, type TabsBlockProps, Testimonials, TestimonialsBlock, type TestimonialsBlockProps, anchorId, index_configs as blockConfigs, isSafeUrl, link, linkGroup, richText, sectionFields, sectionTheme, seedLink, thumbnail };
|